Core Python · Python Cheat Sheets
Compact reference tables for the syntax you look up most often. Every row links to the lesson or reference page that explains it, and the examples are tested on Python 3.13.
All 9
Python Cheat Sheet (Python 3.13 Quick Reference)
This Python cheat sheet puts the most-used syntax for Python 3.13 into tables of tested one-liners: numbers, operators, strings, …
Python String Cheat Sheet: Methods and FormattingPython strings are immutable text: use slicing to cut them, methods such as `upper()`, `strip()`, `split()` and `replace()` to tr…
Python List Cheat Sheet: Methods and ExamplesA Python list is an ordered, changeable collection: add with `append()`, `extend()` and `insert()`, remove with `remove()`, `pop(…
Python Dictionary Cheat Sheet: Methods and ExamplesA Python dictionary maps unique keys to values: read with `d[key]` or `d.get(key, default)`, add with `d[key] = value` or `update…
Python Control Flow Cheat Sheet: if, for, while, matchPython control flow uses `if`/`elif`/`else` to choose, `for` and `while` to repeat, `break` and `continue` to steer loops, and `m…
Python Functions Cheat Sheet: def, args, lambda, scopeDefine a Python function with `def name(parameters):` and `return` a result; use default values, `*args` and `**kwargs` for flexi…
Python OOP Cheat Sheet: Classes, Inheritance, Dunder MethodsIn Python OOP you define a `class` as a blueprint, build objects with it, store data in attributes set in `__init__`, share behav…
Python Regex Cheat Sheet (re Module Quick Reference)Python regular expressions live in the `re` module: write the pattern as a raw string, then use `re.search()`, `re.findall()`, `r…
Python File Handling Cheat Sheet: open, read, write, CSV, JSONOpen files with `with open(path, mode, encoding="utf-8") as f:` so they close automatically, read with `read()`, `readlines()` or…
Explore more
Python ReferencePython ProgramsPython ComparisonsPython How-To GuidesPython glossaryPython tutorial