Python Strings and Collections Cheat Sheet
A 2-page reference for strings, lists, dicts and sets: 15 short entries with copy-ready code.
ForDevelopers
// Common string methods
s = " Hello, World "
s.strip().lower()
"a,b,c".split(",")
"-".join(["a", "b"])
// Find and replace
"hello".startswith("he")
"hello".find("l")
"hello".replace("l", "L")
// Formatting numbers
f"{3.14159:.2f}" # 3.14
f"{42:05d}" # 00042
f"{1234567:,}" # 1,234,567
// List comprehensionWhat's inside
- Format
- PDF, Markdown
- Contents
- 15 sections · 2 pages
- Version
- 1.0 · Updated 3 Oct 2026
- Licence
- Commercial What this means
- Checked
- Checked before it ships
- python-strings-and-collections-cheat-sheet.pdfPDF · 20 KB
- python-strings-and-collections-cheat-sheet.mdMarkdown · 2 KB
- LICENSE.txtadded to every download
About this item
A compact, printable reference for strings, lists, dicts and sets. Each of the 15 entries has a one-line explanation and a small example you can paste into your editor. The PDF uses a two-column A4 layout designed to sit next to your keyboard, and the same content ships as Markdown so you can search it or drop it into your notes. Every Python example targets Python 3.12.
- Collections
- Dictionaries
- Python
- Strings
- Cheat sheet
Reviews
No reviews yet.