The suffix names of python files are: ".py", ".py3", ".pyc", ".pyo", ".pyd", ".pyi", ".pyx", ". pyz", ".pywz", ".rpy", ".pyde", ".pyp", ".pyt".
Python file suffix summary:
(1).py:
Expanded with py The file named is a Python source code file, which is interpreted by python.exe and can be run under the console. Can be read and written with a text editor.
(2).py3:
Python3 script (Python3 scripts usually end with .py instead of .py3 and are rarely used).
(3).pyc:
The pyc extension is the compiled file of Python. It executes faster than py files and cannot be edited and viewed with text editing. So pyc files are often released instead of py files.
When Python is executed, it will first compile the source code in the py file into PyCodeObject and write it into the pyc file, and then the virtual machine will execute PyCodeObject. When Python executes import, it will first look for the corresponding pyc or pyd (dll) file. If not, the corresponding py file will be compiled and written into the pyc file. pyc files can also be generated by python -m py_compile src.py.
.pyc binary files can be decompiled into .py files, and the decompilation software is called Easy Python Decompiler.
(4).pyo:
pyo is an optimized and compiled program and cannot be edited with a text editor. python -O source.py can compile the source program into a pyo file.
This is the *.pyc file created when optimizing (-O). Starting from Python3.5, Python will only use .pyc instead of .pyo and .pyc.
(5).pyd:
This is basically a Windows DLL file.
pyd is generally a Python extension module written in other languages other than Python, such as C/C. It is a dynamic link library of Python, which is equivalent to a dll file. In Linux systems, it is generally a .so file
(6).pyi:
MyPy stub, stub file (PEP 484).
(7).pyw:
Windows Python script executed with pythonw.exe.
The pyw file is similar to the pyc file, but the console window will not appear when pyw is executed. When developing (pure graphical interface program), you can temporarily change pyw to py to bring up the console window for debugging.
(8).pyx:
Convert Cython src to C/C.
(9).pyz:
Python Script Archive (PEP 441) (this is a script that contains a compressed Python script (ZIP) in binary form after the standard Python script header).
(10).pywz:
Python Script Archive for MS-Windows (PEP 441) (This is a compressed Python script (ZIP) containing the binary form after the standard Python script header ) script).
(11).py[cod]: The wildcard character in
.gitignore indicates that the file may be .pyc, .pyo, or .pyd.
(12).rpy:
An RPython script or Python script that contains application or framework specific functionality.
(13).pyde:
The Python script used for processing.
(14).pyp:
Py4D Python plug-in.
(15).pyt:
Python declaration file.
Recommended learning: Python video tutorial
The above is the detailed content of What is the suffix of python files?. For more information, please follow other related articles on the PHP Chinese website!