I'm a beginner in phyton. i'm just starting to read things about phyton because we need it for our project. I really need basic and detailed instructions on how to use it and use it using notepad++. Could someone help me? or teach me? ill also do my part and do more researches so plss help me :) pls make it as simple as possible for me to understand. :)

Recommended Answers

All 4 Replies

so if I understan corectly you want instructions on how to code python in Notepad++ then run it if so you would do this:
make sure you've downloaded and installed python!!! (it's best to download 2.7)
1. open Notepad++ and set the file as python (at the bottom of the window there should be a menu with many different languages you can code in, select python from that list)
2. Code normally
3. save as a .py file
To run:
1. open CMD (command prompt (i'm assuming your on windows as you're using notpad++))
2. navigate to the directory your .py file is in using the cd command
3. use this command:

python <filename>.py

insert the file name where it says <filename> then hit enter, if there are no errors the code will run, if there are errors then it will tell you so.

Also when you install python it comes with it's own IDE to get to it do this:
1. on your desktop (or somewhere) there should be a python 2.7 directory (or a different version) open it
2. in it you should see IDLE, open that, it should come up with terminal like window
3. go to File > new, or use CTRL+N which will open a new window which resembles a simple text editor, code python normaly in it
4. save your code as a .py file

to run from that:
1. press f5 or goto run>run module, it may prompt you to save, do so
2. the teminal-like window from before will come up and it will show any errors in there, and if your coding a command line interface it will work like you CMD would

if you have any questions please ask :)

@red23 IDLE has its own text editor that you can use instead of npp. Of course npp is a great text editor but the one in IDLE is also not bad.

I have Notepad++ installed on my Windows PC at work and there are three plugins which I use for writing Python scripts:

  1. Python Indent - This plugin is very handy. It will automatically indent your code as you type (but you need to enable it after installing it by selecting 'Plugins->Python Indent->Enable' in the menu)
  2. Python Script - The Python Script plugin (as posted by snippsat above) allows you to programmatically script events in Notepad++ (i.e. automate things inside Notepad++ using python scripts). It can also be used for running other python scripts, but personally I only use the Python Script plugin for automating Notepad++. For most python scripts I use the following plugin...
  3. PyNPP - The PyNPP plugin gives you three additional keybinds to run python scripts:
    ctrl-alt-F5 = Run script in Python
    alt-shift-F5 = Run script in Python Interactive
    ctrl-alt-shift-F5 = Run script in PythonW

NOTE: The keybinds listed above for PyNPP are the default ones that are set when you install the plugin.
If you want to modify them, you can use the 'Run->Modify shortcut/Delete command' menu item to edit the shortcuts. You need to select the 'Plugin commands' tab and scroll through the list of plugin commands until you find the ones for PyNPP and you can edit the keybinds by right clicking on them and selecting 'modify' .

Using PyNPP is simple. You just write your .py file, save it and then hit the appropriate key-bind to run your program. So if you have a command-line only python script, you'll use ctrl-alt-F5 to run in python, or alt-shift-F5 to run in python interactive. If you have a GUI script (wxPython/pyQt) you'll use ctrl-alt-shift-F5 to run pythonw.

To install the python plugins for Notepad++:
Open the 'Plugins->Plugin manager->Show plugin manager' menu item.
In the plugin manager window, select the 'available' tab and select/tick the following three plugins:
Python Indent
Python Script
PyNPP
Then hit the install button to download and install the plugins. NOTE: The installation process will require a restart of Notepad++. Accept this to complete the installation.

NOTE: I've also bound Notepad++'s 'Run->Open current dir' menu item to the F7 key. Again, you can set the shortcut key for the 'Open current dir' command by using the 'Run->Modify shortcut/Delete command' menu item, selecting the 'Run Commands' tab and adding your chosen shortcut.

With this shortcut in place, I can write python scripts in notepad++, then use alt-f7 to open a command window in the directory where the script is saved and can run the script on the command line if I choose to do so.

However, I don't use Notepad++ very often for python. Most of the time I do everything from the command line. Typically using a cygwin terminal, using Vim to create/edit python files and running python from the command line. If I have to debug a script (and the bug is not glaringly obvious from its side-effects) I'll fire up Idle. I usually only use Notepad++ for writing python scripts if I have it open already. But that's just me!

As Snippsat said, there are other, better IDE's/editors available on Windows for writing python scripts. Many of which offer code completion and all kinds of other advantages. Personally, I'm not too worried about code completion. And I'm happy with my primitive command line setup, but Idle and Notepad++ (with the extra plugins) are both very handy too!

commented: very informative post +13
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.