The relevant use of strings 1, the definition of a string (single and double quotes are OK)
name = ' Hello World ' /single quotation mark
name = "Hello World" //double quote
2, the operation of the string
(1) Concatenation of strings
(2) member operator operator: "In" "Not in"
str1 = ' Hello '
str2 = ' world '
str3 = ' OK ' and ' he
' in str1//interpreting ' he ' is in str1, apparently ' he ' is in str1, so the result is true
STR3 not in STR2//Because the string in STR3 is not str2, the result is True
(3) String cutting: string[i:j: K]--I represents the starting position, J represents the end position, but does not include the contents of the J unit, K represents a character out of every K-character.
(3) string formatting:
Syntax: str% (the value you need to enter) to replace the value in parentheses with the value you want to enter in the template
3, to Output "There have 3 people" You can use the following syntax
num = 3
print (' There hava%d people '% (num))