编程札记

P

Python3 字符串String Expandtabs 方法

Python3 字符串String Expandtabs 方法 #!/usr/bin/python3 str = "this is\tstring example....wow!!!" print ("Original string: " + str) print ("Defualt exapanded tab: " + str.expandtabs()) print ("Double exapanded tab: " + str.expandtabs(16))

阅读全文 ↗
P

Python3 字符串String Endswith 方法

Python3 字符串String Endswith 方法 #!/usr/bin/python3 Str='this is string example....wow!!!' suffix='!!' print (Str.endswith(suffix)) print (Str.endswith(suffix,20)) suffix='exam' print (Str.endswith(suffix)) print (Str.endswith(suffix, 0, 19))

阅读全文 ↗
P

Python3 字符串String Encode

Python3 字符串String Encode #!/usr/bin/python3 import base64 Str = "this is string example....wow!!!" Str = base64.b64encode(Str.encode('utf-8',errors = 'strict')) print ("Encoded String: " , Str)

阅读全文 ↗