Printable Python Cheat Sheet
Free printable Python 3 syntax cheat sheet at exact scale — the syntax you use every day grouped by task: variables and types, strings, lists, tuples, dicts and sets, control flow, functions, classes, comprehensions, files, error handling and imports, all on one page.
This Python cheat sheet collects the syntax that turns up in almost every script and groups it by what you’re trying to do — assigning variables and casting types, formatting text with f-strings, slicing sequences, building and updating lists and dictionaries, and looping with for, while, break and continue.
It also covers writing functions with default, keyword and variadic arguments, lambda expressions and type hints, defining classes with __init__, methods and inheritance, and the Pythonic power tools that make code concise: list, dict and set comprehensions, generator expressions, the with statement for files, and try/except/finally error handling.
Which Python topics are covered?
Variables and assignment, numeric and text types, operators, string methods and f-strings, lists and tuples, dicts and sets, if/elif/else and match, for/while loops, functions (defaults, *args/**kwargs, lambda, type hints, decorators), classes and inheritance, comprehensions and generators, file I/O with with open, exceptions, and importing modules.
Which Python version is this for?
Python 3. The syntax works on modern Python 3.x; a few items note the version they arrived in, such as structural pattern matching (match/case) added in Python 3.10.