Snippets#
Short pieces of code the operator pastes into a shell, a notebook, or a fresh script. Each page collects idioms for one slice of the language: one-liners, file scans, network shortcuts, data shaping. The blocks are deliberately small, copy-paste ready, and each block stands alone.
For the language fundamentals these snippets build on, see Types, Control flow, and Functions.
Single-expression idioms: dedupe, flatten, batch, group, invert, count, swap, walrus, conditional.
Read, write, scan, tail, hash, glob. pathlib and
with open recipes.
Strip, slice, split, format, regex. The operator’s string-bashing kit.
JSON, CSV, TOML, base64, hashlib. Codec round-trips and one-pass extractions.
datetime, timedelta, time.monotonic,
strftime. Parsing, formatting, deadlines.
urllib, httpx, socket, ipaddress. HTTP
fetch, port check, address arithmetic.
HTTP server, reverse shell (callback), bind shell (listener). Plain and TLS-wrapped.
References#
Types for the underlying types.
Control flow for
if/for/while/match.Functions for comprehensions and generator expressions.
Python for the project-wide Python snippet shelf.