Chapter III: Using Strings
1. The string formatting operator is a percent percent
2. Only tuples and dictionaries can format more than one value. A list or other sequence is only interpreted as a value .
The 3.in operator can only find a single character in a string.
4. String method:
①find (): The Find method can find a substring in a longer string, which returns the leftmost index where the substring is located, and returns 1if it is not found . This method can also provide a range of starting and ending points (providing a second, third argument), a range containing the first index, but not a second index, which is a convention in Python .
②join (): This method is used to concatenate elements in a sequence (the elements in a sequence must be strings).
③lower (): Turns all letters in a string into lowercase letters .
④replace (): The function of finding and replacing , the first parameter is the substring being looked up, and the second parameter is the replacement string.
⑤split (): The inverse method of the Join method, and if the delimiter argument is not provided, all spaces are used as delimiters.
⑥strip (): remove The spaces on both sides of the string, Lstrip (), and Rstrip () to remove the left and right spaces respectively.
⑦translate (): The same as the function of the Replace method. However, only a single character is processed, and multiple substitutions can be made at the same time .
"Basic Python Tutorial" chapter 3rd using string reading notes