Home > Backend Development > Python Tutorial > What is the python file extension

What is the python file extension

爱喝马黛茶的安东尼
Release: 2019-06-26 11:33:26
Original
27681 people have browsed it

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')
Copy after login

The output result is:

.gif
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template