Jun-27-2018, 11:35 AM
(This post was last modified: Jun-27-2018, 11:35 AM by gontajones.)
Docstring must be before the imports:
#!/usr/bin/python3 """ A Twitter username can only contain alphanumeric characters (A-Z numbers 0-9). The exception being an underscore. Symbols, dashes or spaces are not valid. Examples: @zyx - valid @xyz_abc - valid, since it contains an underscore @abc!abc - invalid, since it contains a special character xyz@abc - invalid, since characters that prefix the @ are not allowed @999 - valid @abc 999 - invalid, since spaces cannot form part of the username """ import re def test_doc(): """ This is a test """ if __name__ == "__main__": print(__doc__) # print(main.__doc__) print(test_doc.__doc__)From Imports
Quote:Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.