1, strip can remove the specified element in the string, if you do not specify an element, the default is to remove spaces and strings.
2, Statistics occurrences, string.count ()
3. Find an element according to the subscript. There are two ways of index and find.
(1) Index can only find the subscript of an existing element, if the element does not exist will be an error
(2) Using Find query, the advantage is that if the element does not exist, no error, return-1
4. Replace
(1) Replace, replaces the specified string with a new string in the syntax format: String.Replace (' Old string ', ' new string ')
(2) Change to uppercase/lowercase letters
String.upper (): Capitalize the string
String.Lower (): Change the string to lowercase
5. The following results are true or false
String.isdigit (): Whether the string is a purely numeric
String.isalpha (): Whether the strings are all letters
String.isalnum (): Whether the string contains a letter or a number, including one that is true
String.startswith (' str1 '): Whether the string starts with str1
String.endswith (' str2 '): Whether the string ends with str2
There's a lot more to do with strings, so here's a quick introduction.
python-string manipulation