Source: https://mokxi.com/learn/path/python-automation
Updated: 2026-11-20

All paths

# Automate it with Python

Let Python do a lab's chores: command-line tools with argparse, safe bulk renaming, logging, schedules that keep time, a watched inbox folder, reports written for you, and a lab notebook bot with a live temperature sensor.

Raspberry Pi 4 Model B Free 7 lessons 5 h 4 chapters 2,081 XP Coding · Intermediate +150 XP

0 of 7 done

Start the course free Scripts and argparse Lesson plan for teachers

What you will build

## 3 projects, built step by step

7 lessons in 4 chapters, about 5 hours on a simulated Raspberry Pi 4 Model B. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### Bulk renaming

Rename a folder of microscope photos safely: a regular expression that reads messy names, a plan before any change, conflicts found before they destroy a file, a dry run, the real rename, and an undo log in JSON.
Open it in the simulator

Chapter 2 project

### Scheduling on the clock

Run jobs on time: a sleep loop and the drift it builds up, a fixed-rate schedule that does not drift, several jobs at different rates, the next 09:00 worked out with datetime, and a clean stop with Ctrl-C.
Open it in the simulator

Chapter 3 project

### Reports

Turn a class experiment's CSV into a report nobody has to type: load and convert, group into means, write a Markdown table to report.md, add highlights, and fill a message from a string.Template.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Tools

Scripts with real options, and changing a folder of files without fear.

Open 236 XP

### Scripts and argparse

Turn a program into a command-line tool: sys.argv, an argparse parser with a positional, options, types, choices and defaults, a real LED blinked by the arguments, --help for free, clear errors, and arguments typed live in the Serial Monitor.

0 of 6 steps

Start What is in it

Project Locked 410 XP

### Bulk renaming

Rename a folder of microscope photos safely: a regular expression that reads messy names, a plan before any change, conflicts found before they destroy a file, a dry run, the real rename, and an undo log in JSON.

0 of 5 steps

4 questions, graded as you go.

Chapter 2

## Logs and time

Know what your script did, and run it on time.

Locked 205 XP

### Logging

Replace print with logging: five levels, a format with the level and logger name, levels that filter, named loggers per part of a program, a log file that keeps only what matters, and tracebacks with log.exception.

0 of 5 steps

Project Locked 410 XP

### Scheduling on the clock

Run jobs on time: a sleep loop and the drift it builds up, a fixed-rate schedule that does not drift, several jobs at different rates, the next 09:00 worked out with datetime, and a clean stop with Ctrl-C.

0 of 5 steps

5 questions, graded as you go.

Chapter 3

## Pipelines

React to files as they arrive, and turn data into reports.

Locked 205 XP

### Watching a folder

Process files the moment an instrument drops them: a button that writes sample files, a polling watcher that spots new names, processing and moving each file so it is done once, bad files sent to an errors folder, and a running count.

0 of 5 steps

Project Locked 410 XP

### Reports

Turn a class experiment's CSV into a report nobody has to type: load and convert, group into means, write a Markdown table to report.md, add highlights, and fill a message from a string.Template.

0 of 5 steps

4 questions, graded as you go.

Chapter 4

## Boss

A lab notebook bot built from everything in the course.

Locked 205 XP

### Boss: a lab notebook bot

A bot that keeps the lab's notebook: notes with time stamps in Markdown, measurements from a live temperature sensor on a fixed-rate schedule with argparse options, bad arguments logged instead of crashing, a report, and a logged alarm.

0 of 5 steps

3 questions, graded as you go.

Syllabus

## Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Tools

- Scripts and argparse Turn a program into a command-line tool: sys.argv, an argparse parser with a positional, options, types, choices and defaults, a real LED blinked by the arguments, --help for free, clear errors, and arguments typed live in the Serial Monitor.
- Bulk renaming Rename a folder of microscope photos safely: a regular expression that reads messy names, a plan before any change, conflicts found before they destroy a file, a dry run, the real rename, and an undo log in JSON.

Chapter 2

### Logs and time

- Logging Replace print with logging: five levels, a format with the level and logger name, levels that filter, named loggers per part of a program, a log file that keeps only what matters, and tracebacks with log.exception.
- Scheduling on the clock Run jobs on time: a sleep loop and the drift it builds up, a fixed-rate schedule that does not drift, several jobs at different rates, the next 09:00 worked out with datetime, and a clean stop with Ctrl-C.

Chapter 3

### Pipelines

- Watching a folder Process files the moment an instrument drops them: a button that writes sample files, a polling watcher that spots new names, processing and moving each file so it is done once, bad files sent to an errors folder, and a running count.
- Reports Turn a class experiment's CSV into a report nobody has to type: load and convert, group into means, write a Markdown table to report.md, add highlights, and fill a message from a string.Template.

Chapter 4

### Boss

- Boss: a lab notebook bot A bot that keeps the lab's notebook: notes with time stamps in Markdown, measurements from a live temperature sensor on a fixed-rate schedule with argparse options, bad arguments logged instead of crashing, a report, and a logged alarm.

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Automate it with Python

Is Automate it with Python free?

Yes. All 7 lessons of Automate it with Python are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Raspberry Pi 4 Model B?

No. Every lesson runs on a simulated Raspberry Pi 4 Model B with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Automate it with Python take?

About 5 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Bulk renaming, Scheduling on the clock and Reports.

Where do I start?

With "Scripts and argparse", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
