@dataclass
A decorator that automatically generates __init__, __repr__, and __eq__ methods from class fields. Each field is declared with its name and type annotation — no need to write a constructor manually. Part of the standard library via from dataclasses import dataclass. |
io
Python's standard library module for working with streams and file-like objects. Provides in-memory file objects that behave exactly like real files but exist only in RAM. BytesIO is for binary data, StringIO is for text data. read(n) reads exactly n bytes from the current cursor position — useful for parsing binary formats where you need to read fixed-size chunks. |
struct
Converts between Python values and C-style binary data using format strings. struct.unpack(format, bytes) reads bytes and returns a tuple of Python values. struct.pack(format, values) converts Python values into bytes. |
Cheatography
https://cheatography.com
Python (Standard Libraries) Cheat Sheet (DRAFT) by blakecromar
Cheatsheet on command standard libraries on Python
This is a draft cheat sheet. It is a work in progress and is not finished yet.