Skip to content

Posts

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 …

Read more →

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 …

Read more →

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 …

Read more →

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 …

Read more →

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 …

Read more →

October 11, 2026

Python Basics: Working with Files Using pathlib

Python’s standard-library pathlib module represents filesystem paths as objects. It can join paths, read small text files, and find matching filenames without building shell …

Read more →

October 11, 2026

Python Basics: Reading and Writing JSON Files

JSON is useful for small configuration files and data exchanged between programs. Python’s standard-library json module converts JSON into dictionaries, lists, and other Python …

Read more →

October 11, 2026

Python Basics: Reading and Writing CSV with Headers

CSV files often contain a header row followed by records. Python’s standard-library csv module handles quoted fields, including values that contain commas. Use Python 3 on Linux. …

Read more →

October 11, 2026

Python Basics: Querying SQLite with Parameters

SQLite stores a database in a local file without a separate database server. Python’s standard-library sqlite3 module can create tables, insert records, and query them using SQL. …

Read more →

October 11, 2026

Python Basics: Adding Command-Line Arguments with argparse

Python’s standard-library argparse module turns command-line arguments into named values. It also generates help text and reports invalid input. Use Python 3 on Linux. Run the …

Read more →

October 11, 2026