Python String Methods: A Beginner’s Reference

Python strings come with a powerful set of built-in string methods that let you manipulate text with ease. Whether you’re formatting output, searching for characters, or cleaning up user input, these methods are your toolkit.

🔍 Note: All string methods return new strings — they don’t modify the original.

Complete List of Python String Methods with Descriptions

MethodDescription
capitalize()Converts the first character to uppercase
casefold()Converts the string to lowercase (more aggressive than lower())
center()Centers the string within a given width
count()Counts how many times a value appears
encode()Encodes the string into bytes
endswith()Returns True if the string ends with the specified value
expandtabs()Sets the tab size (e.g., converts \t to spaces)
find()Returns the first index of a specified value
format()Inserts values into placeholders {}
format_map()Like format(), but uses a dictionary
index()Returns the first index of a value (raises error if not found)
isalnum()Returns True if all characters are alphanumeric
isalpha()Returns True if all characters are alphabetic
isascii()Returns True if all characters are ASCII
isdecimal()Returns True if all characters are decimal numbers
isdigit()Returns True if all characters are digits
isidentifier()Returns True if the string is a valid Python identifier
islower()Returns True if all characters are lowercase
isnumeric()Returns True if all characters are numeric
isprintable()Returns True if all characters are printable
isspace()Returns True if all characters are whitespace
istitle()Returns True if the string is title-cased
isupper()Returns True if all characters are uppercase
join()Joins elements of an iterable into a string
ljust()Left-justifies the string
lower()Converts the string to lowercase
lstrip()Removes leading whitespace
maketrans()Creates a translation table
partition()Splits the string into three parts around a separator
replace()Replaces a substring with another
rfind()Returns the last index of a value
rindex()Returns the last index (raises error if not found)
rjust()Right-justifies the string
rpartition()Like partition(), but starts from the right
rsplit()Splits from the right
rstrip()Removes trailing whitespace
split()Splits the string into a list
splitlines()Splits at line breaks
startswith()Returns True if the string starts with the specified value
strip()Removes leading and trailing whitespace
swapcase()Swaps uppercase to lowercase and vice versa
title()Converts each word’s first character to uppercase
translate()Applies a translation table to the string
upper()Converts the string to uppercase
zfill()Pads the string with zeros on the left

Learn about strings here

lets talk strings and String Methods
Scroll to Top