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\t123'.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(' \n\r\t'.isspace())

 

posted @ 2019-04-17 22:14  挺锅锅  阅读(802)  评论(0编辑  收藏  举报