3 can not be named with the keyword
4. Do not use the Chinese name, not the name is too long
the above mentioned id # is used to indicate the value of the variable in memory only a memory address
type type # variable value
value value # variables
naming conventions: variable names all uppercase
python3:
the INPUT ()
Print ()
Integer: int
role: name, sex, nationality, address and other descriptive information
name = 'tank'
1, according to the index value (Forward + Reverse take take): can only take
2, sections (care regardless of the end, step)
3, the length len
. 4, the members in operation in and Not
. 5, shift In addition to the blank Strip
. 6, segmentation Split
. 7, loop
. 1, Strip, the lstrip, The rstrip
2, Lower, Upper
. 3, startsWith, endsWith
. 4, the format of the three kinds of games are played
. 5, Split, rsplit
. 6, the Join
. 7, Replace
. 8, isdigit
name = " aleX" print(name,name.strip())
2, it is determined whether the value of "al" variable name corresponding to the beginning, and outputs the result
name = " aleX" print(name.startswith('al'))
3, corresponding to the variable name is determined whether the value of an "X" at the end, and outputs the result
name = " aleX" print(name.endswith('X'))
4, the value corresponding to the variable name in the "l" is replaced with "p", and outputs the result
name = " aleX" print(name.replace('l','p'))
5, the name of the corresponding variable value in accordance with "l" division, and outputs the result
name = " aleX" print(name.split('l'))
6, the corresponding value becomes the variable name in uppercase, and outputs the result
name = " aleX" print(name.upper())
7, the name variable value corresponding to lower case, and the output
name = " aleX" print(name.lower())
8, please outputs of the two character values corresponding to the variable name?
name = " aleX" print(name[1])
9, please output the first three characters of the name value of the corresponding variable?
name = " aleX" print(name[:3])
10, please output the value of two variables corresponding character name?
name = " aleX" print(name[-2:])
11, please output value corresponding to the variable name in the index where the "e" position?
name = " aleX" loc = [] for i,j in enumerate(name): if j=='e': loc.append(i) print(loc)
12, to obtain sequences, removing the last character. Such as: oldboy then get oldbo
name = " aleX" print(name[:-1])