Python3 字符串String Rstrip 方法
Python3 字符串String Rstrip 方法 #!/usr/bin/python3 str = " this is string example....wow!!! " print (str.rstrip()) str = "*****this is string example....wow!!!*****" print (str.rstrip('*'))
阅读全文 ↗Python3 字符串String Rstrip 方法 #!/usr/bin/python3 str = " this is string example....wow!!! " print (str.rstrip()) str = "*****this is string example....wow!!!*****" print (str.rstrip('*'))
阅读全文 ↗Python3 字符串String Rjust 方法 #!/usr/bin/python3 str = "this is string example....wow!!!" print (str.rjust(50, '*'))
阅读全文 ↗Python3 字符串String Rindex 方法 #!/usr/bin/python3 str1 = "this is really a string example....wow!!!" str2 = "is" print (str1.rindex(str2)) print (str1.rindex(str2,10))
阅读全文 ↗Python3 字符串String Rfind 方法 #!/usr/bin/python3 str1 = "this is really a string example....wow!!!" str2 = "is" print (str1.rfind(str2)) print (str1.rfind(str2, 0, 10)) print (str1.rfind(str2, 10, 0)) print (str1.find(str2)) print (str1.find(str2, 0, 10)) print (str1.find(str2, 10, 0))
阅读全文 ↗Python3 字符串String Replace 方法 #!/usr/bin/python3 str = "this is string example....wow!!! this is really string" print (str.replace("is", "was")) print (str.replace("is", "was", 3))
阅读全文 ↗Python3 字符串String Min 方法 #!/usr/bin/python3 str = "www.codingdict.com" print ("Min character: " + min(str)) str = "CODINGDICT" print ("Min character: " + min(str))
阅读全文 ↗Python3 字符串String Max 方法 #!/usr/bin/python3 str = "this is a string example....really!!!" print ("Max character: " + max(str)) str = "this is a string example....wow!!!" print ("Max character: " + max(str))
阅读全文 ↗Python3 字符串String Lstrip 方法 #!/usr/bin/python3 str = " this is string example....wow!!!" print (str.lstrip()) str = "*****this is string example....wow!!!*****" print (str.lstrip('*'))
阅读全文 ↗Python3 字符串String Lower 方法 #!/usr/bin/python3 str = "THIS IS STRING EXAMPLE....WOW!!!" print (str.lower())
阅读全文 ↗Python3 字符串String Len 方法 #!/usr/bin/python3 str = "this is string example....wow!!!" print ("Length of the string: ", len(str))
阅读全文 ↗Python3 字符串String Join Sequence 方法 #!/usr/bin/python3 s = "-" seq = ("a", "b", "c") # This is sequence of strings. print (s.join( seq ))
阅读全文 ↗Python3 字符串String Isupper 方法 #!/usr/bin/python3 str = "THIS IS STRING EXAMPLE....WOW!!!" print (str.isupper()) str = "THIS is string example....wow!!!" print (str.isupper())
阅读全文 ↗