one, the distinction between command-line mode and Python interaction mode
Command-line mode:
Python interactive mode
Second, text editor
1. Never use Notepad that comes with Word and Windows . Word does not save plain text files, and Notepad will be smart to add a few special characters (UTF-8 BOM) to the beginning of the file, resulting in an inexplicable error in the program running. Text editor available notepad++, Sublime text, editplus, individual with more than EditPlus
2. print
Be careful not to have any spaces in front.
3. Write the Python program in a text editor, and then save the file as a suffix .py
(the suffix must be. py) so you can run the program directly with Python. The file name can only be a combination of English letters, numbers, and underscores
What is the difference between 4.Python Interactive mode and direct running .py
files?
Direct input python
into interactive mode is equivalent to launching the Python interpreter, but waiting for you to enter the source code one line at a line to execute each row.
Running the .py
file directly is equivalent to launching the Python interpreter and then .py
executing the file's source code at once, and you don't have the opportunity to enter the source in an interactive way.
5. It is possible to run the Py file directly on Mac and Linux, not in Windows
Written code can also be used in the Web version-"Code run assistant run, do not want to install the environment, you can try
inputs, outputs input (), print ()
Print () output, which outputs multiple
Difference: Print out the middle is-"comma or space
1 Print ("hello,world"# Result: Hello,world23print( " Hello "World"# result: Hello world
Input () Inputs:
1 name = input (")2print('hello ', ' , name) 3 4 # The results are as follows: 5 # Please enter your Name:michael "Michael is prompted and later re-entered" 6 # Hello, Michael.
The first Python program of the Liaoche Python tutorial