Python String Methods

About This Index
This page is the Python String Methods index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn what a string is on /python/string. Use this page when you need a specific API such as capitalize(), find(), or format().
Start with capitalize(), find(), format(), and isdigit()—then browse the rest by category.
How to Call a String Method
Call methods with dot notation on a str value:
text = "Hello, Python!"
print(text.capitalize())
print(text.find("Python"))
print(text.endswith("!"))
print("Count: {}".format(3)) Python String Methods Table
All method guides in this Python tutorial series (15 tutorials).
Case & formatting
3 methodsChange letter case and align text inside a width.
| Method | Description | Tutorial |
|---|---|---|
capitalize() | First character upper, rest lower. | Try it |
casefold() | Aggressive lowercase for comparisons. | Try it |
center() | Center text within a width. | Try it |
Search & check
4 methodsLocate substrings, count matches, and test suffixes.
Tabs & whitespace helpers
1 methodExpand tabs into spaces (more split/join methods coming in this series).
| Method | Description | Tutorial |
|---|---|---|
expandtabs() | Replace tabs with spaces. | Try it |
Validation
4 methodsReturn True or False to validate character content.
Encoding & templates
3 methodsBuild formatted messages and convert text to bytes.
Frequently Asked Questions
Start with capitalize()
Open the first case method—syntax, examples, and FAQs.
15 people found this page helpful
