Notepad++ Run Python Script: A Completed Guide – Python Tutorial

By | April 6, 2020

Notepad++ is a powerful editor,  it is also a python editor for python programmers. In this tutorial, we will introduce how to edit and run python script by it.

Preliminary

You should install Notepad++ and python first.

To install python, you can read this tutorial:

Install and Use Both Python 2 and Python 3 in Windows with Anaconda

Create a python file

You should open notepad++ and create a python script, here is an example:

import time

text = 'this is https://www.tutorialexample.com'

print(text)

time.sleep(5)

Then we will introduce how to run this python script by notepad++.

Press Run or F5 on the notepad++

You can start to clicking run or press F5 to start to run python script.

start to set notepad++ to run python script

Set the path of python script

As to our python environment, the absolute path of python.exe is:

C:\Users\fly165\.conda\envs\py3.6\python.exe

Then you can add this string in the input box below:

C:\Users\fly165\.conda\envs\py3.6\python.exe $(FULL_CURRENT_PATH)

Where $(FULL_CURRENT_PATH) represents the current file, which means if you want to run a python script, you should foucs on this file.

Moreover, if the type of current file is not .py, you will can not run it.

set notepad++ run python script

Save command 

We can save our command that runs python script with the name: Run Python.

Here is an example:

notepad++ save the command that runs python script

Then you can Press Alt+F7 to run python script on notepad++.

notepad++ run python script command

In this tutorial, the resutl of python script is:

the result that notepad++ runs python script

Leave a Reply

Your email address will not be published. Required fields are marked *