PythonStudy——字符串扩展方法 String extension method

print('000123123'.find('1'))
print('000123123'.rfind('1'))
print('***000123123***'.lstrip('*'))
print('***000123123***'.rstrip('*'))
print('华丽分割线'.center(50,'='))
print('华丽分割线'.ljust(50,'='))
print('华丽分割线'.rjust(50,'='))
print('123'.zfill(10))
print('%010d' % 123)
print('000	123'.expandtabs(30))
print('AbC'.swapcase())

print(''.isdigit())
print(''.isdecimal())
print(''.isnumeric())  # True
print(''.isnumeric())  # True
print(''.isnumeric())  # True

print('a_1'.isidentifier())
print('ABCc'.isupper())
print('ABCc'.islower())
print('Aooc Abc Aaa'.istitle())
print(' 

	'.isspace())
原文地址:https://www.cnblogs.com/tingguoguoyo/p/10726616.html