Search⌘ K
AI Features

Built-in String and List Functions

Explore Python's built-in functions for strings and lists. Understand various string methods for checking, case changes, searching, and replacing text. Learn list methods to add, remove, search, and arrange elements to build effective Python programs.

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 returns True if all characters in the string are alphanumeric.
  • The isalpha() method returns True if all characters in the string are in the alphabet.
  • The isdigit() method returns True if all characters in the string are digits.
  • The islower()
...