A file containing Python code is called a script. All you need to create scripts is a simple text editor, but it's best to use a Python-aware editor such as SciTE (see Figure 2-1) or IDLE (which comes with the standard distribution of Python).
Just save your script with a .py extension, so that your operating system knows that it contains Python. To run a script, you typically just double-click it, or if you prefer the command line, type python followed by a space and the name of your script. Most Python editors will have a shortcut key to run the script you have been editing.
■Note Python allows both spaces and tabs for indentation, but it is better to use four spaces. Most Python editors will be set this way, but you may have to check it in the Options dialog of your editor.
Was this article helpful?