Posts
Python Basics: Validating IP Addresses and Subnets with ipaddress
Python’s standard-library ipaddress module turns address text into objects you can validate, compare, and check against a subnet. Use Python 3.12 or newer in Bash on Linux. Each …
October 12, 2026
Python Basics: Reading INI Settings with configparser
An INI file groups settings under section headings such as [app]. Python’s standard-library configparser module reads these settings and converts common value types. Use Python …
October 12, 2026
Python Basics: Reading and Writing Compressed Text with gzip
Python’s standard-library gzip module reads and writes compressed text, including logs and exports saved as .gz files. Use Python 3.12 or newer in Bash on Linux. Examples run …
October 12, 2026
Python Basics: Managing Cleanup with contextlib
An open file needs closing even when processing fails. Python’s with statement gives that cleanup a clear place. Start with built-in context managers, then use contextlib when a …
October 12, 2026
Python Basics: Building and Reading URLs with urllib.parse
Python’s standard-library urllib.parse module separates URL components and encodes values containing spaces or special characters. Use Python 3.12 or newer in Bash on Linux. These …
October 12, 2026
Python Basics: Taking the Next Item with heapq
A queue of jobs often needs the most urgent item next. Python’s heapq module maintains a heap in a list, with the smallest item at index zero. Use Python 3.12 or newer on Linux. …
October 12, 2026
Python Basics: Summarizing Measurements with statistics
A few summary numbers can make a small set of measurements easier to inspect. Python’s standard-library statistics module handles common averages and measures of spread. Use Python …
October 12, 2026
Python Basics: Searching Sorted Lists with bisect
Python’s bisect module finds where a value belongs in an already sorted list. It helps locate duplicate ranges and insert new records without sorting everything again. Use Python …
October 12, 2026
Python Basics: Reusing Results with functools
A script may repeat the same calculation many times. A small cache can reuse earlier results. Python’s standard-library functools module provides lru_cache() for this job. Use …
October 12, 2026
Python Basics: Giving Choices Names with enum
A job status has a small set of allowed choices. An enumeration gives each choice a name and value, so code can use Status.READY consistently. Use Python 3.12 or newer on Linux. …
October 12, 2026