June 2019
Beginner to intermediate
770 pages
19h 24m
English
Python modules have a typical organization. To an extent, this is defined by PEP 8, about which more information can be found at http://www.python.org/dev/peps/pep-0008/.
The first line of a module can be a #! comment; a typical version looks like the following code:
#!/usr/bin/env python3
This is used to help OS tools, such as bash, locate the Python interpreter for an executable script file. For Windows, this line may be something along the lines of #!C:\Python3\python.exe.
Older Python 2 modules may include a coding comment to specify the encoding for the rest of the text. This may look like the following code:
# -*- coding: utf-8 -*-
The coding comment is avoided for Python 3; the OS encoding information ...
Read now
Unlock full access