brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: python -m calendar prints a calendar in your terminal

Terminal
~/tips/tip-python-calendar-module-cli

python3 -m calendar -m 4 2027

Prints a text calendar for a year or month without installing anything.

You do not need an app to see which weekday the 24th falls on. The standard library prints a calendar by itself.

python3 -m calendar 2026 12
python3 -m calendar -m 4 2027

With a year and a month you get that month. With only a year you get all twelve. Without arguments, the year argument falls back to the current year. The -m option sets the number of months per row, three by default.

It can also write HTML. -t html produces a page, and -c adds a CSS file, which is a quick way to print a year planner.

python3 -m calendar -t html 2027 > planner.html

The first day of the week is Monday for Python by default, which suits the Netherlands. In Python 3.13 and later -f lets you change it, where 0 is Monday and 6 is Sunday.

The caveat is that -L for a locale also requires -e for the encoding, so Dutch month names need both. And it is only a calendar: it has no idea about holidays, so for Koningsdag you still look at the date yourself.

Further reading: Python calendar module

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link