Configuring Your Editor
When writing Python programs, you’ll need to indent some of the lines with a fixed number of spaces to delimit blocks of code which are part of a function, loop or if statement. Although you can use any number of spaces to indent your code or even use tabs instead of spaces, it is good practice to use 4 spaces and avoid tabs altogether. In fact you cannot mix spaces and tabs in your code.
IDLE and other Python Integrated Development Environments (IDEs) are already set up to automatically add the correct indentation for you. However, if you are using another code editor, make sure you configure your editor to replace tabs with 4 spaces. That way you can use the tab key to create an indentation in Python and it will automatically be replaced with 4 spaces.
In Notepad++:
To replace tabs with 4 spaces:
Go to Preferences -> Language Menu/Tab Settings and check 'Replace by space'
You can also install plugins to run python code from notepad++ or to automatically indent code.
In Emacs:
Here are some instructions to set up emacs for python : http://caisah.info/emacs-for-python/
If you’re using another text editor, you’ll find instructions on the web on how to set it up for Python.