Python learning notes (2) two ways to implement the first python program, learning notes python
In interactive mode:
If you want Python to print the specified text, you can usePrintStatement, and then enclose the text to be printed in single or double quotation marks, but the single quotation marks and double quotation marks cannot be mixed:
>>> Print 'hello, world'
Hello, world
In interactive mode, although it is convenient, the Code cannot be saved once it is executed. Next we will write it in a text editor and save it.
Open notepad ++ and select the edited code, python
# Hello. py
Print 'Hello world'
The last file name is hello. py. Open the command line cd to the file storage path, and then enter python hello. py.
Result:
Python hello. py
Hello world
Note:
1. # The python comments are similar to the C language //, and the subsequent text python will not be executed.
2. If Chinese characters are output, they must be converted to unicode encoding in the format of print u'hao'
3. Check whether your path is correct when no file is displayed.