1. Python download address: http://www.python.org
Second, python comments: #
三、>>> print("i love python")
i love python
>>> print(5+3)
8
>>> 234567567*67890890
15925000888764630
>>> print("WELL water"+"river")
WELL waterriver
---Concatenation of strings
>>> print("i love python"*8)
i love pythoni love pythoni love pythoni love pythoni love pythoni love pythoni love pythoni love python
>>> print("i love python\n" *8)
i love python
i love python
i love python
i love python
i love python
i love python
i love python
i love python
---The function of "/n" is a newline operation
>>> print("i love python\n" + 8)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
print("i love python\n" + 8)
TypeError: must be str, not int
---The reason for the error: The + sign means splicing, the same type can be spliced with different types and cannot be spliced, "i love python\n" + 8 is the splicing of character type and shaping, so an error will be reported
4. Use IDLE Shortcut keys to call up the last and next input text:
A. Mac: control+n (recall the last inputted text); control+p (recall the next inputted text)
B. Windows: alt+n, alt+p
5. Embed a double quotation mark in python: two methods
>>> print('"i love python"')
"i love python"
---Single quotation marks
>>> print("\"i love python\"")
"i love python"
--- escape with a backslash
6. The difference between directly printing 'i love python' and print('i love print'):
"i love python"
>>> 'i love python'
'i love python'
>>> print('i love python')
i love python
>>>
---Comparison can know that the former prints both the type and the result, the latter only prints the result