#!/usr/bin/evn python# Aothor Jackname ="my \tname IS {name},i am {year}"print(name.capitalize())#大寫首字母,中間轉爲小寫print(name.count("a"))print(name.center(50,"-"))print(name.encode())#字符串輸出print(name.endswith("ck"))print(name.expandtabs(tabsize=30))#jiangTab轉換爲空格print(name.find("name"))#找出存儲位print(name.format(name='Jack',year=23))print(name.format_map( {'name':'jack','year':23} ))#字典print(name.isalnum())#是否爲字母加阿拉伯數字print(name.isalpha())#純英文字母print(name.isdecimal())#判斷是否爲十進制print(name.isdigit())#判斷是否爲int值print(name.isdigit())#判斷是否爲int值print("ab".isidentifier())#判斷是否爲合法的標識符print(name.isdigit())#判斷是否爲int值print('33A'.isnumeric())#是否爲一個數字print(name.isspace())#判斷是否爲空格print(name.istitle())#判斷每一個單詞首字母是否大寫print(name.isprintable())#判斷是否能打印tty file drive等不能打印print(name.isupper())#判斷全部是否爲大寫print("ax".islower())#判斷全部是否爲小寫print('+'.join(['1','2','3']))#1+2+3print(name.ljust(50,'*'))#my name IS {name},i am {year}********************print(name.rjust(50,'*'))#********************my name IS {name},i am {year}print('Jack'.lower())#jackprint('Jack'.upper())#JACKprint(' Jack'.lstrip())#去掉左邊的空格和回車print('\n Jack '.rstrip())#去掉右邊的空格和回車print(' Jack '.strip())#去掉左邊和右邊的空格與回車p=str.maketrans('abcdef','123456')print("alex li".translate(p))#1l5x liprint('alex li'.replace('l','L'))#aLex Liprint('alex li'.replace('l','L',1))#aLex Li只替換1個print('alex li'.rfind('l'))#找到指定字符l的且是最右對的下標print('alex li'.rsplit())#['alex', 'li']按照默認的空格把字符串分紅一個列表print('alex li lo'.rsplit('l'))#['a', 'ex ', 'i ', 'o']按照指定的字符’l‘把字符串分紅一個列表print('Alex Li'.swapcase())#aLE X lIprint('Alex Li'.zfill(50))#0000000000000000000000000000000000000000000Alex Li