.py

What is a .py file?

Python is a high-level programming language known for its readable syntax — the default choice for data science, AI, machine learning, and automation.

Use caution
Type Code
By Guido van Rossum / Python Software Foundation
MIME text/x-python

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

You have a .py file. It's either a data science script, a machine learning model, an automation tool, a web backend, or a university assignment — Python covers all of those, which is why it's the most popular programming language in the world right now.

Python became dominant not because it's fast (it isn't — it's significantly slower than C or Rust for compute-heavy tasks) but because it reads like pseudocode. Indentation is syntax. Variable types are inferred. A script that fetches data from an API, cleans it, and plots a chart can fit on a single screen. This readability made Python the default for data science (pandas, NumPy), machine learning (TensorFlow, PyTorch), automation, and education. The tradeoff — speed — rarely matters because for most work, developer time costs more than CPU time.

Any text editor opens .py files. VS Code with the Python extension is the most popular development environment. PyCharm (free community edition) is more specialised. To run a Python script, you need Python installed (macOS includes it; Windows users download from python.org). The ecosystem lives on pip (the package manager) and PyPI (the package repository).

Technical details
Full Name
Python Script
MIME Type
text/x-python
Developer
Guido van Rossum / Python Software Foundation
Magic Bytes
N/A
Safety
.py requires caution. Python scripts can execute arbitrary code. Only run .py files from trusted sources.
What opens it
Any text editor
FREE All
VS Code
FREE All
PyCharm
FREE All

* Community edition

FAQ
How do I run a .py file?
Install Python from python.org, then open a terminal and type ‘python yourfile.py’ (or ‘python3 yourfile.py’ on macOS/Linux). On Windows, you can also double-click a .py file if Python is installed and associated with the extension.
What is the difference between Python and JavaScript?
Python dominates data science, AI, and automation. JavaScript dominates web browsers and front-end development. Python prioritises readability; JavaScript is event-driven and asynchronous. Both are beginner-friendly, but they solve different problems best.
Is a .py file safe to open?
Reading a .py file in a text editor is safe — it’s just text. Running it executes code that can do anything on your system: read files, install software, access the network. Only run .py files from sources you trust, and review the code first if you’re unsure.
Related formats