S.count(str) |
Counts the number of times string str occurs in string S |
S.find(str) |
Returns index of first occurrence of string str in string S, and -1 if str is not present int string S |
S.rfind(str) |
Returns index of last occurrence of string str in string S, and -1 if str is not present in string S |
S.capitalize() |
Returns a string that has first letter of the string S in uppercase and rest of the characters in lowercase |
S.title() |
Returns a string that has first letter of every word in the string S in uppercase and rest of the characters in lowercase |
S.lower() |
Returns a string that has all uppercase characters in string S converted into lowercase characters |
S.upper() |
Returns a string that has all lower characters in string S converted into uppercase characters |
S.swapcase() |
Returns a string that has all lowercase characters in string S converted into uppercase characters and vice versa |
S.isupper() |
Returns True if all alphabets in string S are in uppercase,else False |
S.islower() |
Returns True if all alphabets in string S are in lowercase,else False |
S.istitle() |
Returns True if string S is in titlecase |
S.replace(str1,str2) |
Returns a string that has every occurrence of string str1 in S replaced by with the occurrence of string str2 |
S.strip() |
Returns a string that has whitespaces in S removed from start and end |
S.lstrip() |
Returns a string that has whitespaces in S removed from start |
S.rstrip() |
Returns a string that has whitespaces in S removed from end |
S.split(delimeter) |
Returns a list formed by splitting the string S into various substring. The delimeter is used to mark the split points |
S.partition(delimeter) |
Partitions the string S into two parts base on delimeter and returns a tuple comprising of string before delimeter |
S.join(sequence) |
Returns a string comprising of elements of the sequence separated by delimeter S |
S.isspace() |
Returns True if all characters in string S comprise of whitespace characters only,i.e. ' ', '\n', '\t' else False |
S.isalpha() |
Returns True if all characters in string S comprise of alphabets only, else False |
S.isdigit() |
Returns True if all characters in string S comprise of digits only, else False |
S.isalnum() |
Returns True if all characters in string S comprise of alphabets and digits only, else False |
S.startswith(str) |
Returns True if string S starts with string str,else False |
S.endswith(str) |
Returns True if string S ends with string str,else False |
S.encode(str) |
Returns S in encoded format according to the given encoding scheme |
S.decode(str) |
Returns the decoded string S according to the given encoding scheme |
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets