What is the common header format of Python files?

This is how Python developers commonly organize their modules/python file −

  • The first line of each file shoud be #!/usr/bin/env python. This makes it possible to run the file as a script invoking the interpreter implicitly.

  • Next should be the docstring with a description.

  • All code, including import statements, should follow the docstring. Import built-in modules first, followed by third-party modules, followed by any changes to the path and your own modules.