Posts
Python Basics: Matching Text with re
Small scripts often need to extract a number, check a label, or tidy spaces. Python’s standard-library re module handles patterns in text. Use Python 3.12 or newer in Bash on …
October 12, 2026
Python Basics: Keeping Related Values in a Dataclass
A task has several related values: a name, a retry limit, and labels. A dataclass gives those values named fields without writing a constructor yourself. Use Python 3.12 or newer …
October 12, 2026
Python Basics: Formatting Plain Text with textwrap
Readable help messages and short previews make command-line scripts easier to use. Python’s standard-library textwrap module provides a few useful formatting tools. Use Python 3.12 …
October 12, 2026
Python Basics: Controlling Decimal Arithmetic and Rounding
Binary floating-point values cannot represent every decimal fraction exactly. Python’s standard-library decimal module lets you work from decimal strings and choose precision and …
October 12, 2026
Python Basics: Combining and Batching Iterators
Python’s itertools module helps process values a little at a time. Try combining groups, taking a slice, and splitting work into small batches. Use Python 3.12 or newer on Linux; …
October 12, 2026
Python Basics: Reading TOML Configuration with tomllib
TOML stores configuration as readable key-value pairs. Python’s standard-library tomllib parses it into dictionaries, lists, and other Python values. Use Python 3.12 or newer on …
October 11, 2026
Python Basics: Reading and Validating Environment Variables
Environment variables let a Python script accept small settings without editing its source. Python’s standard-library os module reads them as strings. Use Python 3.12 or newer in …
October 11, 2026
Python Basics: Hashing Files with SHA-256
A file digest helps detect whether bytes have changed. Python’s standard-library hashlib can calculate a SHA-256 digest without loading the entire file into memory. Use Python 3.12 …
October 11, 2026
Python Basics: Creating and Inspecting ZIP Archives
Python’s standard-library zipfile module can create a ZIP archive, list its members, and read a selected file without extracting it. Use Python 3.12 or newer on Linux. The example …
October 11, 2026
Python Basics: Counting and Grouping with collections
Counting repeated values and grouping records are common jobs in small scripts. Python’s standard-library collections module provides Counter and defaultdict to keep that code …
October 11, 2026