table of Contents
Delete the margins on both sides of the string: rstrip(), lstrip(), strip()
The shortcut key win+R opens the dos window and executes the py command to enter the Python command line mode
Use Ctrl+Z to exit the command line
1. Basic operations
Addition, subtraction, multiplication and division, rounding (round function), high power (**)
Two, variables
Numerical variables
Use variable assignment operations
Character variable
Three, string
Character function : capitalize the first letter of the string (title()), all uppercase (upper()), and all lowercase (lower())
Escape characters : \n, \t
String interception
Delete the margins on both sides of the string: rstrip(), lstrip(), strip()
- rstrip(): delete the margin on the right side of the string
- lstrip(): delete the margin on the left side of the string
- strip(): Remove the margins on the left and right sides of the string
Number to string: str()
age = 22
msg = "我今年" + str(age) + "岁"
print(msg)