The following is a brief introduction to Python file types. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at Python's file types in three ways: source file, byte-code file, and optimized file ). These codes can be run directly without compilation or connection. This is the feature of the pythonlanguage. the pythonfile is interpreted and run through python.exeand pythonw.exe.
1. source code
The Python source file uses "py" as the extension name, which can be run in the console as explained by python.exe. "Pyw" is the extension name of the graphic development user interface (gui.pdf file for desktop applications. This file is used in the graphic interface and is interpreted and run by pythonw.exe.
"Py" and "pyw" files can be opened and edited in a text editor.
2. byte code
After the Python source file is compiled, the extension "pyc" is generated. the file cannot be opened or edited in a text editor. The "pyc" file has nothing to do with the platform. Therefore, Python programs can run on Windows, Unix, Linux, and other systems.
Run the script to compile the "py" file into a "pyc" file.
Import py_compile2 py_compile.compile ("hello. py ")
After running the command, you can get the "hello. pyc" file, which is stored under _ pycache _ in the source file path. See https://www.python.org/dev/peps/pep-3147/
Run:
The above discussion about the Python file type is all the content shared by the small editor. I hope you can give me a reference and support PHP.
For more articles about Python file types, refer to PHP Chinese network!