Pages

Topics

Tools

↑↓navigate↵openescclose

Python guides

Every published Python guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest Python guides

Illustration of a Python string being capitalized, showing the first letter uppercase and rest lowercase.
Python

Python str.capitalize(): Syntax, Behavior, and Edge Cases

An in-depth look at Python's str.capitalize() method: how it handles non-letter first characters, Unicode edge cases, and where it differs from title(), upper(), and casefold().

pythonstring methodscapitalizetext processing
A Python string being transformed to uppercase, showing the .upper() method's effect on characters.
Python

Python String Upper: Syntax, Unicode, and Pitfalls

Learn how Python's str.upper() method converts strings to uppercase, including Unicode behavior, locale considerations, performance notes, and common pitfalls.

pythonstring methodsunicodecase conversion
Illustration of Python string lower method converting uppercase letters to lowercase with Unicode support
Python

Python str.lower(): Syntax, Unicode, and Performance

Learn how Python's str.lower() method converts text to lowercase, how its Unicode handling differs from str.casefold(), and what to consider when lowercasing strings in Python.

pythonstring methodsunicodecasefold
Python string trimming illustration showing strip, lstrip, and rstrip on a text boundary
Python

Python strip vs lstrip vs rstrip: When to Use Each

Understand when to use Python's strip, lstrip, and rstrip methods, including default whitespace handling, custom character removal, and edge cases.

PythonString MethodsWhitespace RemovalText Processing
Illustration of Python rstrip() removing trailing whitespace characters from a string, showing a clean trimmed string.
Python

Python rstrip(): Removing Trailing Whitespace and Characters

Learn how Python's rstrip() method removes trailing whitespace and specific characters from strings, with practical examples and common pitfalls.

Pythonstring methodswhitespacetext processing
Illustration of Python's lstrip() method removing leading characters from the left side of a string.
Python

Python lstrip: Removing Leading Characters from Strings

python lstrip: Learn how Python's lstrip() removes leading whitespace or character sets, how it differs from strip() and rstrip(), and where it commonly fails.

string-methodspython-stringsdata-cleaningtext-processing
Illustration of Python string strip method removing spaces from both ends of a text string
Python

Python String strip() Method: Syntax, Examples, and Pitfalls

python string strip: Learn how Python's strip() method removes leading and trailing whitespace or custom characters, with syntax, examples, and common pitfalls.

pythonstring-methodswhitespacetext-processing
Illustration of Python string join method combining list elements with a separator into a single string
Python

Python String Join: Syntax and Examples

Learn how to use Python's string join() method to concatenate iterables into a single string, with syntax, examples, and common mistakes to avoid.

Pythonstring concatenationjoin methoditerables
Illustration of Python's splitlines method splitting a string into lines at newline boundaries.
Python

Python String splitlines: How to Split on Line Breaks

python string splitlines: Learn how Python's str.splitlines() splits strings at line boundaries, handles universal newlines, and differs from split() - with practical...

string methodsline breakstext processingnewline handling
Illustration of a string being split from the right side, with the last delimiter emphasized and Python colors in a clean editorial style.
Python

Python String rsplit: Splitting from the Right

Learn how Python's rsplit method splits strings from the right, including its maxsplit parameter, edge cases, and when to choose it over split.

Pythonstring methodsrsplittext processing