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
Popular Python guides
Most readLatest Python guides
Page 155 of 179Using Python String rindex to Find the Last Occurrence
Python's `str.rindex()` finds the last occurrence of a substring and returns its starting index. This guide covers syntax, practical examples, error handling, and how `rindex` compares with `rfind`.
Python String Index: Using str.index() Safely
Learn how to use Python's str.index() method to locate substrings, handle ValueError exceptions, and choose between index(), find(), and in.
Using Python string rfind for Right-Side Search
Learn how python string rfind searches from the right, its parameters, return values, and practical differences from find for real-world text processing.
Using Python String find() to Locate Substrings
How Python's str.find() locates substrings, including its return value semantics, start/end parameters, and comparisons with index(), in, and re.search().
Python String endswith: Syntax and Usage
Learn how to use Python's str.endswith() method: syntax, tuple suffixes, start and end parameters, and common edge-case mistakes.
Using Python's str.startswith() for Prefix Checks
Learn how to use Python's str.startswith() for prefix checks, including tuple prefixes, start and end indices, performance, and edge cases.
Python lower vs casefold: Key Differences
Understand the difference between Python's str.lower() and str.casefold() for case-insensitive operations, including Unicode handling and practical examples.
Python String Casefold: Unicode-Safe Case-Insensitive Comparison
Python's casefold() method provides Unicode-safe case-insensitive string comparison, unlike lower(), with practical examples and edge cases.
Python String swapcase(): How to Swap Case in Strings
python string swapcase: Learn how Python's swapcase() method swaps letter case in strings, its Unicode behavior, edge cases, and practical usage with examples.
Python String Title: Using str.title() Correctly
Learn how Python's str.title() method converts strings to title case, including word boundaries, apostrophe handling, Unicode behavior, and practical limitations.