python learning Notes (String related operations supplement)

1.split (str = "", num )
to intercept a delimiter string str, and stores the result in a list. Specified num, num taken only string
Here Insert Picture Description
2.splitlines ([keepends])
in accordance with ( '\ r', '\ r \ n', '\ n') separated, keepends = True retained when the line breaks
Here Insert Picture Description
3.join (seq)
specified string delimiter, all the elements are combined into a seq string
Here Insert Picture Description
4.max ()
to find the maximum value in the string, by comparing ASCII
Here Insert Picture Description
5.min ()
to find the minimal string the value
Here Insert Picture Descriptionreturned is a space
6.replace (oldstr, newstr, count)
replaced oldstr with newstr, the default is replace all. If the count of the specified number, only the first alternative to count
Here Insert Picture Description
7.startswith (str, start = 0, end = len (str1))
is determined in a given range if at the beginning of a given string, if not specified range default entire string
Here Insert Picture Description
8.endswith (str, start, end = len (str1))
is determined in a given range if at the end of the given string, if not specified range, the entire string default
Here Insert Picture Description
9.encode (encoding = "utf-8", errors = "strict") # encode
decode () # decoding
Note: the same encoding format encodes
Here Insert Picture Description
10.isalpha ()
If there is at least one character string, and all characters are letters, returns True, otherwise return False
Here Insert Picture Description
11.isalnum ()
if there is at least one character string, and all characters are letters or numbers, then returns True, otherwise return False
Here Insert Picture Description
12.isupper ()
if there is at least an English character string, and all the characters are in uppercase letters, it returns True, otherwise return False
Here Insert Picture Description
13.islower ()
has at least one if the string English characters, and all characters are lowercase letters, returns True, otherwise it returns False
Here Insert Picture Description
14.istitle ()
If the string is the title (string first letter of each word is capitalized) of True is returned, False otherwise
Here Insert Picture Description
15.isdigit ()
If the string contains only numeric characters return True, False otherwise
Here Insert Picture Description
16.isspace ()
If the string contains only spaces, returns True, otherwise False
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/weixin_38324954/article/details/94597908