Posts
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
Python Basics: Testing a Function with unittest
Python’s standard-library unittest module checks behavior automatically. Use Python 3.12 or newer on Linux. Run the shell commands in order in the same shell, starting in a fresh …
October 11, 2026
Python Basics: Running Commands with subprocess
Python’s standard-library subprocess module runs another program and collects its result. These Linux examples use Python 3.12 or newer and only launch small Python commands. Pass …
October 11, 2026
Python Basics: Recording Events with logging
Python’s standard-library logging module records events with severity levels. A script can show important messages while keeping diagnostics quiet. Use Python 3.12 or newer on …
October 11, 2026
Python Basics: Parsing Timestamps and Converting to UTC
Python’s standard-library datetime module parses timestamps, converts offsets, and calculates durations. These examples use Python 3.12 or newer on Linux. The saved scripts create …
October 11, 2026
Python Basics: Creating Temporary Files with tempfile
Python’s standard-library tempfile module creates temporary files and directories for tests and intermediate results. Use Python 3.12 or newer on Linux. Each example creates a …
October 11, 2026