1. All lowercase string: lower ()
casefold () a wider range of
2. string all uppercase: upper ()
3. judged whether the case: isupper ()
islower()
4. center: center (width, fillchar = None)
>> 'python'.center(10,'-')
>> '--python--'
The sequences find string Occurrence: COUNT (char, = None Start, End = None)
6. The string is determined whether the beginning or end xx: startswith (char, start, end)
endswith(char,start,end)
7. From looking back, find the first position after its acquisition: find ()
>> 'pythonpython'.find('py') >> 1
8. The first position of a character or character string appearing: index ()
>> 'pythonpython'.index('y')
>> 1
9. determines whether the string contains only letters and numbers: isalnum ()
10 determines whether the string contains only symbols: isalpha ()
11. Input is determined whether the current number: isdecimal ()
Wider isdigit () range
isnumeric () on a wider scope than
>> '②'.isdecimal()
>> False
>> '②'.isdigit()
>> True
>> '二'.isdigit()
>> False
>> '二'.isnumeric()
>> True
12. Case Conversion (uppercase to lowercase lowercase variant uppercase): swapcase ()
>> 'Python'.swapcase() >> 'pYTHON'
13 determines whether the string is valid Python identifier used to determine whether a valid variable names: isidentifier ()
14 whether there is a character can not be displayed: isprintable () containing information indicating the False output unprintable \ t
>> 'python\tpython'.isprintable() >> False
15. whether the string is all whitespace: isspace ()
16. The string is converted to title: title ()
>> 'python is good'.title() >> 'Python Is Good'
17. The string is determined whether the title: istitle ()
18. The character string inserted between each of the characters or character string developed: join ()
>> '' .join ( ' new island' ) >> "New Treasure Island '
Determining whether the string, to the title: istitle ()
19. Left alignment padding: ljust (width, fillchar = None)
20. Right alignment padding: rjust (width, fillchar = None)
>> 'python' .ljust (20, '_' )
>> 'python______________'
21. The removal of the matching character strip ()
lstrip()
rstrip()
>> 'pythonohtyp'.strip('9py') >> 'thonoht'
22. The string segmentation: partition ()
>> 'pypypypypypy'.partition('y') >> ('p', 'y', 'pypypypypy')
rpartition()
>> 'pypypypypypy'.rpartition('y')
>> ('pypypypypyp', 'y', '')
split (char, number)
>> 'python'.split('h') >> ['pyt', 'on']
23. Instead of a certain original string a string: replace (oldchar, newchar, replacement times)
>> 'python'.replace('py','PY')
>> 'PYthon'