Python file extensions

Various file extensions in Python:

Here follows a list of Python file extensions. I request the readers to add any more missing file extensions, related to python environment.

 
file extension Description
.py regular python source code script
.pyc compiled Bytecode Script

.pyo optimized  .pyc script, resulted when the invoked with -O option
.pyw

Python script for Windows.

It is executed with pythonw.exe. Useful in cases where the script need to be executed in the background, without resulting in console output

.pyd

Python script, as a Windows DLL file.

Useful when we dont want to reveal the source code, but only the application to the client

 
.pxd Cython script, which is equivalent to a C/C++ header
.pyx Cython source code which is to be converted to C/C++

.pth used to add import path for site-packages
.py3

(rarely used) Python3 script.

In general, Python3 scripts usually end with ".py" not  ".py3"

.pyz

Python script archive (PEP 441);

Contains compressed Python scripts (ZIP) in binary form after the standard Python script header.

It is a platform independent file format

.pywz

Python script archive for MS-Windows (PEP 441);

Contains compressed Python scripts (ZIP) in binary form after the standard Python script header.

It is for windows platform only.

.py[cod]  It is a wildcard notation in ".gitignore" which means the file may be either ".pyc",   ".pyo", or ".pyd". 

 

 

Popular posts from this blog

List of Websites to get free e-books

Online IDEs/Interpreters for python programming