Home > Article > Backend Development > What is the extension of python script file
The extension of python script file is: 1. [.py], py is the most basic source code extension; 2. [.pyw], pyw is another source code extension; 3. [. pyc], which is the compiled bytecode of Python source code.
The extensions of python programs are .py, .pyc, .pyo and .pyd. .py is the source file, .pyc is the compiled source file, .pyo is the source file optimized and compiled, and .pyd is a python library written in other languages.
Extension
The common extensions we use when writing Python programs are py and pyc. In fact, there are several other extensions. The following are the usages of several extensions.
py: py is the most basic source code extension. Directly double-clicking to run under windows will call python.exe for execution.
pyw: pyw is another source code extension. The only difference from py is that double-clicking the source code of the pyw extension under Windows will call pythonw.exe to execute the source code. This execution method does not have a command line window. . Mainly used when publishing GUI programs without seeing console information.
pyc: When executing python code, you often see pyc files with the same name automatically generated in the same directory. This is the compiled bytecode of python source code. Generally, the pyc file of the py file referenced in your code will be automatically generated when the code is executed. This file can be executed directly, and the source code cannot be seen when opened with a text editor.
pyo: pyo is an optimized and encoded file similar to pyc.
pyd: pyd is not generated from a python program, but an extension written in other languages that can be called by python.
Recommended tutorial: "Python Tutorial"
The above is the detailed content of What is the extension of python script file. For more information, please follow other related articles on the PHP Chinese website!