Most common methods for strings
The following table summarizes the most common methods for strings. For instance, if s is a string, s.lower() returns s converted to lower cases. All operations on sequences are authorized. Code | Description |
s.capitalize() | Returns a copy of s in upper cases |
s.center(width) | Returns a copy of s centered on a string of width characters |
s.count(sub[,start[,end]]) | Returns the number of occurrences of sub in s |
s.encode([encoding[,errors]]) | Returns the encoded version of s |
s.endswith(suffix[,start[,end]]) | Returns TRUE if s ends with a suffix |
s.expandtabs([tabsize]) | Returns a copy of s where all tabulations are replaced with tabsize spaces |
s.find(sub[,start[,end]]) | Returns the first index of s where sub was found |
s.index(sub[,start[,end]]) | Same as 'find' but returns an error sub is not found |
s.isalnum() | Returns TRUE if all characters of s are alpha numeric |
s.isalpha() | Returns TRUE if all characters of s are alpha |
s.isdigit() | Returns TRUE if all characters of s are numeric |
s.islower() | Returns TRUE if s is in lower case. |
s.isspace() | Returns TRUE if s only contains spaces |
s.istitle() | Returns TRUE if each word in s starts with an upper case |
s.isupper() | Returns TRUE if all characters in s are in upper case |
s.join(seq) | Returns the concatenation of strings of the sequence seq separated by s |
s.ljust(width) | Returns a left justified copy of s with a maximum length of width characters |
s.lower() | Returns a lower case copy of s |
s.lstrip() | Returns a copy of s, trimming all spaces on the left. |
s.replace(old, new[, maxsplit]) | Replaces old with new in s |
s.rfind(sub[,start[,end]]) | Returns the last index of s where sub was found |
s.rindex(sub[,start[,end]]) | Same as rfind but returns an error if not found |
s.rjust(width) | Returns a right-justified copy of s with a maximum length of width characters |
s.rstrip() | Returns a copy of s, trimming all spaces on the right |
s.split([sep[,maxsplit]]) | Returns a list of words from s, using sep as a separator |
s.splitlines([keepends]) | Returns the list of lines from s |
s.startswith(prefix[,start[,end]]) | Returns TRUE if s starts with prefix |
s.strip() | Returns a copy of s trimming all spaces on the left and right |
s.swapcase() | Returns a copy of s with uppercases converted to lowercases and vice versa |
s.title() | Returns a copy of s where all words start with an uppercase. |
s.translate(table[,deletechars]) | Translates s according to table |
s.upper() | Returns an uppercase copy of s |
Thank you for sharing valuable comments for us its very incredible post to whom looking for a particular course if any one who want to learn tally core to advance
ReplyDeleteOracle Data Integration Training in Bangalore
Thanks for this. I really like what you've posted here and wish you the best of luck with this blog and thanks for sharing
ReplyDeleteOracle Data Integration training in bangalore