In Python's interactive command line to write programs, the advantage is that you can get results, the disadvantage is unable to save, the next time you want to run, you have to knock again.
So, in the actual development, we always use a text editor to write code, finished, saved as a file, so that the program can be run repeatedly.
Download a text editor, can not use the Windows bring Notepad and Word can, so save not plain text files, will add some of their own code or something, error
: http://www.sublimetext.com/
Enter a small program in the sublime text editor
Saved under a directory (where the location is stored under the E-Disk Python folder)
The suffix of the file name to be saved is. py
And then run
See similar C:\>
command-line mode that is provided in Windows:
In command-line mode, you can execute python
into the Python interactive environment or python hello.py
run a .py
file.
In a python interactive environment, only Python code can be entered and executed immediately.
In addition, running files in command-line mode differs from running .py
python code directly in a python interactive environment. The python interactive environment automatically prints out the results of each line of Python code, but running the Python code directly does not.
Python language learning 4--using a text editor