Python Reference

The Python Cheat Sheet Every Dev Prints and Pins

Every syntax pattern you actually reach for — organised by topic, not documentation page. Data structures, comprehensions, OOP, decorators and the standard library all in one place. Stop tabbing back to the Python docs mid-function.

$9
One-time payment · Instant PDF download
📄 PDF format ⚡ Instant download 🖨️ Print-ready ♾️ Keep forever
python-cheat-sheet.pdf
DATA STRUCTURES
list = [...]Create list
dict = {k:v}Key-value pairs
set = {...}Unique items
COMPREHENSIONS
[x for x in iterable]List comp
{k:v for ...}Dict comp
(x for x)Generator
FUNCTIONS
def func(*args, **kw)Variable args
@decoratorWrap function
lambda x: x+1Anonymous fn

What's inside the Python Cheat Sheet

8 sections covering every part of practical Python — from basic data types to advanced OOP and the standard library.

🔢

Data Types & Casting

Every built-in type with conversion functions and type-checking patterns.

  • int, float, str, bool, bytes
  • Type casting (int(), str(), float())
  • isinstance() and type()
  • None and truthiness rules
📋

Lists, Tuples, Dicts & Sets

All four core data structures with their most useful methods and operations.

  • List slicing and methods
  • Tuple packing and unpacking
  • Dict methods (get, items, update)
  • Set operations (union, intersection)

List & Dict Comprehensions

Write cleaner, faster Python with comprehension syntax for every collection type.

  • List comprehensions with conditions
  • Dict comprehensions
  • Set comprehensions
  • Generator expressions
🔧

Functions (args/kwargs/decorators)

Everything you need to define powerful, flexible Python functions.

  • *args and **kwargs patterns
  • Default and keyword arguments
  • Decorator syntax and stacking
  • Lambda and higher-order functions
🏗️

OOP (classes/inheritance/dunder)

Object-oriented Python from class definition to magic methods.

  • Class and __init__ syntax
  • Inheritance and super()
  • Dunder methods (__str__, __repr__)
  • @property and @classmethod
📁

File I/O & Context Managers

Read, write and manage files the Pythonic way with context managers.

  • open() modes (r, w, a, rb, wb)
  • with statement pattern
  • Reading lines and writing
  • pathlib.Path operations
📦

Standard Library Modules

The most-used stdlib modules so you stop reaching for unnecessary third-party packages.

  • os, sys, pathlib
  • json, csv, datetime
  • re (regex), collections
  • itertools, functools
🛡️

Error Handling & Exceptions

Write resilient Python with proper exception handling and custom exceptions.

  • try / except / else / finally
  • Raising exceptions
  • Custom exception classes
  • Common built-in exceptions

Who this cheat sheet is for

  • Data scientists who write Python daily but still Google list comprehension syntax
  • Backend developers building APIs and automation scripts in Python
  • Automation and scripting developers who need quick stdlib references
  • Developers switching to Python from JavaScript or PHP
  • Students learning Python OOP for the first time

What you get

📄
PDF file
High-resolution, print-ready PDF. Works on any device.
Instant access
Download immediately after purchase via Gumroad.
🖨️
Print-optimised
Designed to look perfect on A4 or US Letter paper.
♾️
Yours forever
One payment. No subscription. Download again any time.
Instant Download
$9
One-time payment · PDF · No subscription

Get the Python Cheat Sheet now

Stop tabbing back to the docs. Keep the answer pinned to your wall instead.

Buy on Gumroad →