Python import string find . >>> bookname = "new concept english" >>> import string >>> index = string.find(bookname, "s") >>> print index 17 findstringfind find string.find >>> string.find("www.qswtp.com", "com") 10 >>> string.find("I love Python!", ’o’, 5) 11 >>> string.find("I love Python!", ’o’, 1) 3 >>> string.find("compaq", ’c’, 1, 3) -1 >>> string.find("compaq", ’p’, 1, 3) -1 -1 string string.lowercasestring.uppercase string.digits09 >>> import string >>> print string.lowercase abcdefghijklmnopqrstuvwxyz >>> print string.uppercase ABCDEFGHIJKLMNOPQRSTUVWXYZ >>> print string.digits 0123456789 35
Python string.lowercase import string def isLower(char): return string.find(string.lowercase, char) != -1 inin import string def isLower(char): return char in string.lowercase import string def isLower(char): return ’a’
show all