Built-in String and List Functions
Learn to use popular built-in functions related to strings and lists in Python.
Built-in functions for strings
Python provides various built-in functions for dealing with strings. These functions are collectively called string methods.
Note: All string methods return a new string without changing the original one.
There are numerous tasks related to strings that make it easy for programmers to perform routine tasks. This section will provide examples and results of some commonly used string methods.
The is...
methods
These methods are used to check the category of the symbols stored in a string (digits, alphabets, lowercase, title case, etc). Let’s explore these methods through an example program.
- The
isalnum()
method returnsTrue
if all characters in the string are alphanumeric. - The
isalpha()
method returnsTrue
if all characters in the string are in the alphabet. - The
isdigit()
method