Posts
Python Basics: Working with Months and Weekdays Using calendar
For a monthly checklist, you might need the number of days, a grid of weeks, or every Friday. Python’s standard-library calendar module handles these small date-planning tasks. …
October 13, 2026
Python Basics: Working with In-Memory Streams with io
Sometimes a function expects a file-like object, but your data is already in memory. Python’s io.StringIO holds text, while io.BytesIO holds bytes. Both provide familiar stream …
October 13, 2026
Python Basics: Packing Binary Records with struct
A small sensor record might contain a device number and a reading. Python’s struct module lets you turn those numbers into a defined sequence of bytes and read them back. These …
October 13, 2026
Python Basics: Escaping and Unescaping Text with html
When a page should display Tea & <biscuits> literally, the text needs escaping. Python’s html module can escape text for HTML and decode HTML character references. Before you start …
October 13, 2026
Python Basics: Creating and Reading Identifiers with uuid
A record or import job often needs an identifier. Python’s standard-library uuid module can generate random IDs, recreate name-based IDs, and read existing UUID text. Before you …
October 13, 2026
Python Basics: Sorting Records with operator
Sorting records often starts with choosing a field. Python’s operator module provides small helper functions that extract dictionary items or object attributes for sorted() to …
October 12, 2026
Python Basics: Inspecting Text with unicodedata
Two strings can look alike while containing different Unicode code points. Python’s unicodedata module helps inspect characters and normalize equivalent spellings. Use Python 3.12 …
October 12, 2026
Python Basics: Filling Text with string.Template
For a short message with a few named fields, string.Template provides simple dollar-sign placeholders. Keep the wording in a template and supply the values separately. Use Python …
October 12, 2026
Python Basics: Encoding Bytes with base64
Some text-based formats need binary data represented as printable characters. Python’s base64 module converts bytes to an ASCII representation and back. Use Python 3.12 or newer on …
October 12, 2026
Python Basics: Calculating Exact Ratios with fractions
A recipe or measurement can involve values such as one third. Python’s fractions module stores a rational number as an integer numerator and denominator, so calculations with these …
October 12, 2026