In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "summary of Python3 string operation methods", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Python3 string operation method summary" bar!
1capitalize () converts the first character of a string to uppercase 2center (width, fillchar) returns a string centered by the specified width width. Fillchar is a padded character, which defaults to a space. 3count (str, beg= 0 endurance string (string)) returns the number of times str appears in string, and if specified by beg or end, there is no decode method in 4bytes.decode (encoding= "utf-8", errors= "strict") Python3, but we can use the decode () method of bytes object to decode a given bytes object, which can be encoded by str.encode (). 5encode (encoding='UTF-8',errors='strict') encodes a string in the encoding format specified by encoding. If an error occurs, an exception of ValueError is reported by default, unless errors specifies' ignore' or 'replace'6endswith (suffix, beg=0, end=len (string)) to check whether the string ends with obj, and if beg or end is specified, check whether the specified range ends with obj, if so Returns True, otherwise returns False.7expandtabs (tabsize=8) converts the tab symbol in the string string to spaces. The default number of spaces for the tab symbol is 8. 8find (str, beg=0 end=len (string)) detects whether str is contained in a string. If beg and end specify a range, check whether it is included in the specified range. If it returns the starting index value, otherwise it returns-19index (str, beg=0, end=len (string)) the same as the find () method. However, if str does not report an exception in the string, 10isalnum () returns True if the string has at least one character and all characters are letters or numbers, otherwise False11isalpha () returns True if the string has at least one character and all characters are letters Otherwise, return False12isdigit () if the string contains only numbers, return True otherwise return False..13islower () if the string contains at least one case-sensitive character And all these (case-sensitive) characters are lowercase, return True, otherwise return False14isnumeric () if the string contains only numeric characters, return True, otherwise return False15isspace () if the string contains only spaces, return True, otherwise return False.16istitle () return True if the string is themed (see title ()) Otherwise return False17isupper () if the string contains at least one case-sensitive character, and all these (case-sensitive) characters are uppercase, True is returned, otherwise False18join (seq) is returned with the specified string as the delimiter Merges all the elements in seq into a new string 19len (string) returns the string length 20ljust (width [, fillchar]) returns a new string that is left-aligned and populated with fillchar to the length width. Fillchar defaults to spaces. 21lower () converts all uppercase characters in a string to lowercase .22lstrip () truncates the space to the left of the string 23maketrans () to create a character mapping conversion table. For the simplest way to accept two parameters, the first parameter is a string, indicating the character to be converted, and the second parameter is also the string that represents the target of the conversion. 24max (str) returns the largest letter in the string str. 25min (str) returns the smallest letter in the string str. 26replace (old, new [, max]) replaces str1 in the string with str2, or no more than max times if specified by max. 27rfind (str, beg=0,end=len (string)) is similar to the find () function, but looks for .28r index (str, beg=0,end=len (string)) from the right, similar to index () Just start from the right. 29rjust (width [, fillchar]) returns a right alignment of the original string and uses fillchar (default space) to populate the new string of length width 30rstrip () to remove the space at the end of the string .31split (str= ", num=string.count (str)) num=string.count (str) intercepts the string with str as the delimiter, if num has a specified value Only the num substrings 32splitlines ([keepends]) are truncated, separated by lines ('\ r\ ncharacters,\ n'), and return a list of lines as elements. If the parameter keepends is False, there is no newline character, and if True, the newline character is retained. 33startswith (str, beg=0,end=len (string)) checks whether the string begins with obj, returns True if it is, and returns False otherwise. If beg and end specify values, they are checked within the specified range. 34strip ([chars]) executes lstrip () and rstrip () 35swapcase () on a string to convert uppercase to lowercase, and lowercase to uppercase 36title () returns a "themed" string, which means that all words start with uppercase The rest of the letters are lowercase (see istitle ()) 37translate (table, deletechars= "") convert string characters according to the table given by str (containing 256characters). The characters to be filtered are put into the deletechars parameter. The lowercase letters in the 38upper () conversion string are uppercase 39zfill (width). The original string is right-aligned, and the string is filled with 040isdecimal () to check whether the string contains only decimal characters. If true is returned, the string is right-aligned. Otherwise, false is returned. Thank you for your reading, the above is the content of the "summary of Python3 string operation methods". After the study of this article, I believe you have a deeper understanding of the summary of Python3 string operation methods, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.