1. Build Python environment
Interactive mode: Input Python enters interactive mode, exit () exits interactive mode
Text mode: Create a new *.py file, edit the *.py file, run Python *.py
2. python file type
(1) Source code: Python Source code file with "py" as the extension, interpreted by the Python program, do not need to compile.
For 1.py file standard notation:
#!/usr/bin/python
print ' Hello World '
Run: Mode one: Python 1.py
Way two:./1.py #前提是1. py file has executable permissions
(2) Byte code: The python source file is compiled with the file extension "PYc" and is binary code.
The contents of 2.py are: import py_compile
Py_compile.compile ("1.py")
Running a 2.py file generates a 1.PYC file and 1.pyc is a compiled binary file
3. Optimized code: Optimized source file with ". pyo" extension, binary code
Optimization mode: Python-o-M Py_compile 1.py
Programming of Python Learning