Python3 built-in string parameters

Description:

Use ipython View python3 of built-in functions, just double-click the tab key input string

 

 

  • capitalize (): The first character in a string uppercase
  • casefold: all uppercase letters in a string to lower case
  • center (len, str): Returns a str length len of the string and the original center
  • count (str, begin, end): returns the number of string str occur, start and end indexes may be used to limit the scope
  • encode (encoding, errors): Returns a bytes object, the original string is specified as the encoding format encoding
  • endswitch (str, begin, end): return bool result, to determine whether has ended str, you can specify start and end index
  • expandtabs (tabsize = 8): the institutional innovation tab into a space (the default space tabsize = 8) 
  • find (str, begin, end): Find str is in the string, if found return to the index, find less than -1 is returned, you can specify start and end index
  • format: The format string, string {} as a placeholder
  • format_map ({key: value}): formatted string to a dictionary, wherein the key value placeholder {key}
  • index (str, begin, end): Finds the index of str, if there is no error is returned, you can specify start and end index
  • isalnum (): returns true if the whole string of numbers, letters, numbers and letters
  • isalpha (): If there is at least one character string and all the characters are letters Returns True
  • isascii (): whether the ascii code, it is determined to be a string, or the error
  • isdecimal (): could be interpreted as a decimal number Returns True
  • isdigit (): whether entirely of numbers, it is True Returns
  • isidentifier (): for determining whether Python string is a valid identifier, the variable name can be used to determine the legality
  • islower (): determines whether all lowercase string is Returns True
  • isnumeric (): determines whether the string contains only figure is True if
  • isprintable (): determines whether or not all the characters in the string are printable character string is empty or returns True

Unicode character set "Other" "Separator" character class non-printable characters (but not including the ASCII spaces (0x20)). Analyzing escape character may be used.

ASCII code No. 0 127 to 32 and the second number is a control character; 33 ~ 126 is a printable character, the first of which is 48 to 57 ten arabic numerals 0 to 9; 65 to 26, 90 English uppercase letters, 97 122 ~ 26 lowercase letters.

  • isspace (): a space determination string, returns True
  • istitle (): If the string is the title of the True return
  • issupper (): strings are determined to uppercase, return True
  • join (str): String str link connection elements
  • ljust (len): Returns the original string left-justified, and the use of the new string of blanks filling length len
  • lower (): all uppercase characters to lowercase
  • lstrip (): truncated string spaces left
  • maketrans (in , OUT ): Create a character conversion table mapping (: character string to be replaced, out: in mapping string)
  • partition (str):  for dividing the specified string delimiter
  • replace (str1, str2, len = count (str1)): replace string str1 str2, len denotes the maximum number of replacements
  • rfind (str, begin, end): search string to find from the right, and you can specify an index lookup
  • rindex (str, begin, end): Find an index from the right, you can specify start and end index
  • rjust (len): Returns a string of the original right-justified and padded with spaces to the new string length len
  • rpartition (str): from the right divided by a specified character string
  • rsplit (): delete the end of the string of blanks
  • rstrip (): truncated space on the right strings
  • split (str, len): the string sections according str, len can specify several strings divided
  • splitlines (): by the row division string, it returns a list can specify several strings divided
  • startswith (str): determines whether the string str to start
  • strip (): performs l / r strip () on the string
  • swapcase (): in the case of reversing the string
  • title (): string title (all words capitalized start, the rest are lowercase)
  • translate (str, del): The character string str conversion table is given, the character will be filtered into the del
  • upper (): turn the string in lowercase uppercase
  • zfill (len): returns the length len of the string, the original string right justified, padded with zeros in front of

Guess you like

Origin www.cnblogs.com/hanguoxing/p/11670401.html