Python OOPs


Examples


Others


Python String Functions


In this tutorial, you will learn about Python string methods used for string manipulation.

Python offers many built-in methods for string manipulation.

Method Description
capitalize() Converts the first character to Capital.
casefold() Converts string into lower case. It is simillar to the lower() but it will converts more characters.
center() Returns a string which is center align with the specified character(space is default).
count() Returns the number of occurrences of a substring in the string.
encode() Returns an encoded version of the given string..
endswith() Returns true if the string ends with the given string, otherwise returns False.
expandtabs() Returns a string with all tab characters replaced with given tab size.
find() Used to find the index of first occurence of a substring from the given string.