All String Methods in Python

In programming, string is basically a collection of characters. Characters can be alphabets ( a-z or A-Z ), digits ( 0-9 ), or any other special characters like * , %, $ etc.

In python programming language, anything enclosed in single quotes '' or double quotes "" is known as string.

For example:


message = 'Hello Python!'

Here, 'Hello Python!' is string and message is string variable.

In python we can verify type of variable using standard built-in function type().

For example:


message = 'Hello Python!'
print(type(message))

Output

<class 'str'>

Above output indicates, message is of str (string) class.

Methods in String

To manipulate string while programming, python provides various native methods for different tasks, they are:


If you have any queries regarding string methods in python, please feel free to write in comment below. We will update site as soon as possible to address your query.