Home  >  Article  >  Backend Development  >  What is the python file extension

What is the python file extension

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-26 11:33:2627589browse

What is the python file extension

The only three extensions related to Python are .py, .pyc, and .pyd. The following are all extension files related to Python and their corresponding functions.

.py - Regular script

.py3 - Python3 script (Python3 scripts usually end in .py instead of .py3 and are rarely used)

.pyc - Compiled Script (bytecode)

.pyo - optimized pyc bytecode file (starting from Python3.5, Python will only use pyc instead of pyo ​​and pyc)

.pyw - used Python script for Windows

.pyx executed by pythonw.exe - Convert Cython src to C/C

.pyd - Python script created as Windows DLL

.pxd - Cython script equivalent to C/C header file

.pyi - MyPy stub

.pyi - Stub file (PEP 484)

.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)

.pywz - Python Script Archive for MS-Windows (PEP 441) (This It is a script that contains a compressed Python script (ZIP) in binary form after the standard Python script header)

Related recommendations: "Python Video Tutorial"

.py [ cod] - A wildcard in .gitignore indicates that the file may be a .pyc, .pyo, or .pyd

.rpy - An RPython script or Python script

that contains application or framework specific functionality. pyde - Python script used to process

.pyp - Py4D Python plugin

.pyt - Python declaration file

Here's how to get the file extension:

import os.path 
def file_extension(path): 
  return os.path.splitext(path)[1] 
print file_extension('C:\py\wxPython.gif')

The output result is:

.gif

The above is the detailed content of What is the python file extension. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn