#author = Sooele
name = "my \tsooele is {name} and i am {year} old"
print(name.capitalize())#首字母大学
print(name.count("a"))#列表name中含有多少个a
print(name.center(50,"-"))#输出50给字符。不足用-不足
print(name.endswith("ex"))#是否也ex结尾
print(name.encode())#2进制转换
print(name.expandtabs(tabsize=30))
print(name[name.find("name"):])
print(name.format(name='sooele',year=20))
print(name.format_map( {'name':'sooele','year':12} ))
print('ab23'.isalnum())#是否阿拉伯数字和英文,不包字符
print('abA'.isalpha())#纯英文字符,包括大写
print('1A'.isdecimal())#
print('1A'.isdigit())#整数
print('a 1A'.isidentifier()) #判读是不是一个合法的标识符
print('33A'.isnumeric())#是否一个纯数字。
print('My Name Is '.istitle())#是否每个首字母大写
print('My Name Is '.isprintable()) #tty file ,drive file。。
print('My Name Is '.isupper())#大写
print('+'.join( ['1','2','3']) )#数字前面加符号
print( name.ljust(50,'*') )#长度50.后面不足用*补充
print( name.rjust(50,'-') )#长度50.前面不足用-补充
print( 'SOOELE'.lower() )#大写变小写
print( 'sooele'.upper() )#小写变大写
print( '\nsooele'.lstrip() )#去掉左边空格
print( 'sooele\n'.rstrip() )#去掉右边空格
print( ' sooele\n'.strip() )#去掉全部空格
p = str.maketrans("abcdefli",'123$@456')
print("Sooele".translate(p) )#把前面字符一一兑换
print('Sooele'.replace('l','S',1))#替换
print('Sooelel'.rfind('l'))#
print('1+2+3+4'.split('+'))#字符提取
print('1+2\n+3+4'.splitlines())#
print('Sooele '.swapcase())#大写变小写。小写变大写
print('Sooele'.title())#全部首字符大写
print('Sooele'.zfill(50))#
print( '---')
相关