Skip to content

Most items $2 · Packs priced separately

pocketshelf

Python Strings and Collections Cheat Sheet

python-strings-and-collections-cheat-sheet.pdfShowing 17 of 68 lines
// 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 comprehension

What's inside

  • Python Strings and Collections Cheat Sheet, preview page 1 with code examples in two columnsPage 1
  • Python Strings and Collections Cheat Sheet, preview page 2 with code examples in two columnsPage 2
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
Files in your download
  • 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

You might also grab