encode Encode string to bytes object find rfind Return index of substring or -1 if not found index rindex Return index of substring or raise ValueError title capitalize Title-case the string partition rpartition Partition into 3 parts based on a separator ljust rjust & center Left/right/center...
The following are the methods that can be called on a string object, and each of the following is a link to the respective tutorial, where each tutorial covers the respective method in detail with syntax and examples. String Method Tutorials ...
split() Splits the string from the specified separator and returns a list object with string elements. splitlines() Splits the string at line boundaries and returns a list of lines in the string. startswith() Returns True if a string starts with the specified prefix. If not, it returns ...
- This is a modal window. No compatible source was found for this media.Parametersregexp − A regexp(regular expression) object.Return valueThis method returns an index(position) of the first match between the regexp and the given string.Example 1If...
all Returns True if all items in an iterable object are true any Returns True if any item in an iterable object is true ascii Returns a readable version of an object. Replaces none-ascii characters with escape character bin Returns the binary version of a number bool Returns the boolean val...
# Program to explain reverse string# Using for reversed() function# Define a functiondefreverse_rev(string):# Join reverse object of original stringrstring =''.join(reversed(string))returnrstring string ='Stechies'# Print Original and Reverse stringprint('Original String: ', string)print('Rev...
nextReturns the next item in an iterable objectReturns a new object octConverts a number into an octal openOpens a file and returns a file object ordGiven a string of length one, return an integer representing the Unicode code point of the character when the argument is a unicode object, ...