How to Open Python Files

The Python files have the .py extension. These files can be opened and edited in many different applications. Some of them are simple, and the other offers many features that are useful when you work with Python files.

Open Python files on Windows 10

Notepad

The simplest application to edit files on Windows is notepad. Here, you can open and edit a file. The advantage of this editor is that it’s light and free. The disadvantage is that it doesn’t do anything else.

Notepad++

Notepad++ is a third-party editor that offers many more features than Notepad. It’s free and offers many powerful features.

Notepad++ supports many languages, including Python.

To open a Python file, navigate to File >> Open and the file you want to edit.

You can also change the theme whether you prefer t have a dark or light background. You can do it in Settings >> Style Configurator >> Select theme.

If you use notepad++ only for Python, you can select Language: Python, otherwise, use Global Styles.

It also supports tabbed editing, allowing you to work with multiple files at once.

If you deal with large files, another popular feature is Document Map. It’s a preview of the much bigger chunk of a document, that you can scroll or click to easily access any part of a document.

It’s only available on Windows.

Sublime Text

Another popular Python editor is Sublime Text 3. The advantage over Notepad++ is that it’s cross-platform and can be used on Windows, Mac OS, and Linux.

It offers similar features as Notepad++, but here, you can also run Python scripts.

To open the Python File, go to File >> Open, or Ctrl + O, and choose a script. Here, you have also a document map and syntax highlighter. It’s not universal, and it was created exclusively for Python language.

You can install one of many packages for Sublime Text, where you can use autocomplete features.

To run the script, use Tools >> Build, or Ctrl + B. At the bottom of the screen, you are going to get the result and execution time.

PyCharm

PyCharm is the most powerful and most expensive one on the list. If you want to try it, you can use it for 30 days for free or use a free Community Edition version.

Even the free version is quite powerful and is sufficient for many Python developers.

PyCharm doesn’t offer a document map by default, but it can be easily installed with a CodeGlance plugin.

The free version offers autocomplete, a graphical debugger, and a few other features. You can find the full list on their site.

Run Python Scripts

If you decide to use Sublime Text 3 or PyCharm, you will be able to run code from the program, but if you use Notepad or Notepad++, you can’t run the code there, you can only use these apps as editors.

To run the code, you have to use Command Line.

To open the command line, navigate to the Windows taskbar, and inside the search box type “cmd”.

From the Command Line enter the following line:

Where main.py is your file name.