Monday, March 2, 2015

Using Notepad++ in Windows to edit and run Python programs

In case you have started programming in Python recently and you work in Windows environment, here's an easy method to edit and run your Python code using Notepad++.

Pre-requisites:

1) Python should be installed in your computer. Visit https://www.python.org/downloads/windows/, download and install the appropriate version for your computer. Note the separate 32-bit/64-bit versions. I am using Python 2.7.9, 64-bit version.

2) Notepad++ should be installed in your computer.
Visit http://notepad-plus-plus.org/download. Download and install Notepad++. I am using 6.7.4 version.

Done with the installations? Here's the procedure for executing Python code.


1) Edit the Python code in Notepad++ and save it in any folder of your choice. My source code file is mp1.py (Screenshot 1)

Screenshot 1
 2) Right-click on the tab of the code you want to run and from the drop-down menu select "Open Containing Folder in cmd"

Screenshot 2

3) This will open the Command Prompt in the folder/directory where your current code is saved.

Screenshot 3
 4) Execute your code by entering command "python <source-code>" and hitting enter. For my source code the command would be: "python mp1.py". I found this very easy and simple method.

Screenshot 4
Hope this is of some help to you. In case you have any issues or queries, leave comments or email me: mailrupam@gmail.com.

Follow me on Facebook: https://www.facebook.com/EmbedSysLinuxTrainer

My organization: https://www.facebook.com/nxnvision