In interactive mode:
If you want Python to print out the specified text, you can use a print
statement, and then enclose the text you want to print in single or double quotes, but you can't mix single and double quotation marks:
>>> print ' Hello,world '
Hello,world
In interactive mode, although convenient, but the execution of the code can not be saved, next we use a text editor to write and can be saved.
Open notepad++, choose the code you've edited, Python
# hello.py
print ' Hello World '
The last file name is hello.py, open the command line CD to the file's save path and enter the Python hello.py.
The result is:
Python hello.py
Hello World
Note:
1. #是python的注释部分类似c语言的//, the text python after it is not executed.
2. If the output kanji, must be converted to Unicode encoding, the format of print U ' Hello '
3. Check if your path is correct when you are prompted to do not have a file
Python Learning Note (ii) Two ways of implementing the first Python program