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

Editorial illustration of a Python translation table mapping source characters to replacement characters in a single pass.
Python

Python String Maketrans: Character Translation Tables

Learn how str.maketrans builds translation tables for str.translate, enabling efficient single-pass character mapping and deletion in Python.

Pythonstr.translatecharacter mappingstring manipulation
A clean editorial illustration comparing Python's str.format() method with f-string syntax, showing two formatting approaches side by side.
Python

Python str.format() vs f-strings: Which to Use

Learn the trade-offs between Python's str.format() method and f-strings: syntax, dynamic templates, readability, performance, and version compatibility.

Pythonf-stringsstr.formatstring formatting
Python format method illustration showing a string with placeholders being filled by values
Python

Python format method: syntax, specifiers, and practical use

Learn how Python's `format` method works: placeholders, format specifiers, alignment, type conversion, and when to prefer f-strings.

String FormattingPython SyntaxFormat Specifiersf-strings
Illustration of Python string formatting showing f-string interpolation and format specifiers
Python

Python String Formatting: f-strings and str.format()

Use f-strings and str.format() in Python to control alignment, padding, numbers, dates, and custom objects. Includes format specifier examples and common pitfalls.

f-stringsstr.formatformat specifiersstring interpolation
Illustration of Python string istitle method checking titlecase text
Python

Python string istitle: Checking Titlecase

python string istitle: Learn how Python's str.istitle() works, what it checks, and how to use it for titlecase validation with practical examples and edge cases.

pythonstring methodstitlecasetext validation
Python code snippet showing the isupper() method returning True for an uppercase string and False for a mixed-case string
Python

Python String isupper(): Checking Uppercase Strings

Learn how Python's isupper() string method works: return behavior, Unicode handling, edge cases, and practical validation examples.

Python stringsstring methodstext validationcase handling
A magnifying glass over a string of lowercase and uppercase letters, highlighting the lowercase ones, representing Python's islower() case detection.
Python

Using Python String islower() for Case Detection

Learn how Python's islower() method works, including Unicode behavior, edge cases with digits and symbols, and practical validation examples.

Python stringsstring methodscase detectiontext validation
Python isspace method detecting whitespace characters in a string
Python

Python string isspace: How to Detect Whitespace

python string isspace: Learn how Python's str.isspace() detects whitespace, handles Unicode, and where it fits in input validation and parsing.

pythonstring methodswhitespaceunicode
Illustration of Python's isalnum method checking a string for alphanumeric characters
Python

Python string isalnum: Syntax, Behavior, and Use Cases

python string isalnum: Learn how Python's str.isalnum() works, its Unicode behavior, common use cases, and limitations for validating alphanumeric strings.

PythonString MethodsInput ValidationUnicode
Diagram showing the differences between Python's isdigit, isdecimal, and isnumeric string methods.
Python

Python isdigit vs isdecimal vs isnumeric

Learn the differences between Python's `isdigit()`, `isdecimal()`, and `isnumeric()` methods for Unicode string validation.

Python stringsUnicode digitsString validationCharacter classification