Skip to content

Posts

Python Basics: Measuring Small Operations with timeit

Before replacing readable code with a faster-looking alternative, measure a small, representative operation. Python’s standard-library timeit module helps you repeat that operation …

Read more →

October 13, 2026

Python Basics: Making Random Choices with random

A practice game might need dice rolls, a selection of exercises, or a shuffled question list. Python’s standard-library random module can supply these choices. Before you start …

Read more →

October 13, 2026

Python Basics: Everyday Calculations with math

How many boxes do you need? Are two measurements close enough? How far apart are two points? Python’s standard-library math module provides useful helpers for these small …

Read more →

October 13, 2026

Python Basics: Copying and Moving Files with shutil

Preparing sample folders is a useful way to learn file automation. Python’s standard-library shutil module supplies copying, moving, and directory-removal operations. Here, every …

Read more →

October 13, 2026

Python Basics: Checking Documentation Examples with doctest

A short example beside a function can explain how to use it. Python’s standard-library doctest module lets you check that example when the implementation changes. Before you start …

Read more →

October 13, 2026

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. …

Read more →

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 …

Read more →

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 …

Read more →

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 …

Read more →

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 …

Read more →

October 13, 2026