Python OOPs


Python SQLite


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.
format() Returns a format strings by replacing placeholders in the string with specified values.
index() Used to find the index of first occurence of a substring from the given string.
isalnum() Returns true if all the characters are alphanumeric.
isalpha() Returns true if all characters in the string are alphabet.
isascii() Returns true if all characters in the string are ascii characters.
isdecimal() Returns true if all characters in the string are decimals.
isdigit() Returns true if all characters in the string are digit.
isidentifier() Returns true if all characters in the string are identifier.
islower() Returns true if all characters in the string are lower case.
isnumeric() Returns true if all characters in the string are numeric.