Summary string method, Daquan. python day 6

# String built-in method

ST = # 'Hello Kitty Age {name} {IS}'
#
# Print (st.count ( 'L')) count the number of elements #
# print (st.capitalize ()) # capitalized
# print (st. center (50, '#') ) # centered
# print (st.endswith ( 'tty3' )) # determines whether a content to end
# print (st.startswith ( 'he' )) # determines whether certain content beginning
# Print (st.expandtabs (= 20 is TabSize))
# Print (st.find ( 'T')) # find the first element, and returns the index
# print (st.format (name = ' alex' , age = 37)) # another way output format determined:?: {}
# Print (st.format_map ({ 'name': 'Alex', 'Age': 22 is}))
# Print (ST. index ( 'T'))
# Print ( 'asd'.isalnum ())
# Print (' 12632178'.isdecimal ())
# Print ( '1269999.uuuu'.isnumeric ())
# Print (' abc'.isidentifier ())
# Print ( 'Abc'.islower())
# print('ABC'.isupper())
# print(' e'.isspace())
# print('My title'.istitle())
# print('My tLtle'.lower())
# print('My tLtle'.upper())
# print('My tLtle'.swapcase())
# print('My tLtle'.ljust(50,'*'))
# print('My tLtle'.rjust(50,'*'))
# print('\tMy tLtle\n'.strip())
# print('\tMy tLtle\n'.lstrip())
# print('\tMy tLtle\n'.rstrip())
# print('ok')
# print('My title title'.replace('itle','lesson',1))
# print('My title title'.rfind('t'))
# print('My title title'.split('i',1))
# print('My title title'.title())


Abstract # important method of strings
#. 1 Print (st.count ( 'L'))
# Print (st.center (50, '#')) centered #
# print (st.startswith ( 'he' )) # determining whether to begin a content
# Print (st.find ( 'T'))
# Print (st.format (name = 'Alex', Age = 37 [)) # another way output format determined:?: } {
# Print ( 'My tLtle'.lower ())
# Print (' My tLtle'.upper ())
# Print ( '\ TMY tLtle \ n'.strip ())
# Print (' My title title '. Replace ( 'itle', 'Lesson',. 1))
# Print ( 'My title title'.split (' I ',. 1))

Guess you like

Origin www.cnblogs.com/bdua/p/12174426.html