Skill area · Scripting & Automation

Let Python and AI do the boring work for you

Automate files, reports, websites, and everyday tasks

Renaming a hundred files, pulling numbers from a website, sending the weekly report: if you do it more than twice, a short Python script can do it for you. Real Python teaches you to write scripts and command-line tools you can trust, one practical task at a time.

Scripting & Automation on Real Python

What you’ll be able to do

Automate the tasks that eat your week

Python’s standard library and a handful of well-loved packages cover almost everything you’d want to automate. Real Python shows you how to use them with small, practical examples you can adapt right away.

Files and folders

Find, rename, move, back up, and compress files across whole directory trees without clicking through a file manager.

pathlibshutilzipfile

Command-line tools

Turn a one-off script into a reusable tool with options and help text, and run other programs from Python.

argparseTypersubprocess

Documents and data

Read and write CSV, JSON, Excel, and PDF files, and send the finished report by email.

csvopenpyxlpypdf

The web

Download files, call APIs, scrape pages, and drive a real browser to fill in forms and click through sites for you.

RequestsBeautiful SoupSelenium

Your roadmap

From your first script to tools you can rely on

Not sure where to start? Work through these learning paths in order. Each one mixes tutorials, video courses, quizzes, and exercises, and tracks your progress as you go.

  1. 1

    Start here

    Read and write files, navigate the file system with pathlib, and work with encodings, ZIP archives, and PDFs.

    Learning Path

    Files and File Streams

    13 Resources ⋅ Skills: Python, Pathlib, File I/O, Serialization, Encoding, Unicode, PDF, WAV, Context Managers, ZIP Files

  2. 2

    Dates and times, JSON and CSV, regular expressions, subprocess, and argparse: the batteries-included toolkit behind most automation scripts.

    Learning Path

    Important Standard Library Modules

    16 Resources ⋅ Skills: Python, math, time, calendar, datetime, JSON, CSV, Regex, random, subprocess, argparse, pickle, XML, zipfile, HTTP server

  3. 3

    Make scripts that run unattended fail gracefully, leave a useful log behind, and are easy to fix when something goes wrong.

    Learning Path

    Exceptions, Logging, and Debugging

    8 Resources ⋅ Skills: Python, Exceptions, Logging, Debugging, pdb, raise, Built-in Exceptions, Error Handling

  4. 4

    Make HTTP requests, parse HTML with Beautiful Soup, scale up with Scrapy, and automate a real browser with Selenium.

    Learning Path

    Python Web Scraping

    11 Resources ⋅ Skills: Web Scraping, HTTP Requests, Data Parsing, Browser Automation

  5. +

    Take it anytime

    Run scripts anywhere, package and share them, and automate testing and deployment with CI/CD, Docker, and AWS.

    Learning Path

    DevOps With Python

    11 Resources ⋅ Skills: Packaging & Deployment, CI/CD, AWS, Docker, Logging

New to Python itself? Start with Python Basics first, then come back here.

Try it now

Find files by extension

This is a real exercise from the Practical Recipes for Working With Files in Python video course, and the first step toward a script like the one above. Write your function in the editor and click Run Tests.

Loading exercise...

Running tests, hints, and solutions are included with a Real Python membership. Not a member yet? You can still read the task and write your solution before you join.

Learn it every way

Read it, watch it, test it, practice it

Every automation topic comes in the formats that help it stick. Mix them however you like.

Tutorials

In-depth, example-driven guides to pathlib, subprocess, argparse, web scraping, and more.

Start with pathlib →

Video courses

Follow along as an instructor builds real scripts, one bite-sized lesson at a time.

Watch the file recipes course →

Quizzes

Check what you’ve learned in a few minutes and see exactly which concepts to review.

Test your standard library skills →

Coding exercises

Write real file-handling, logging, and scraping code in your browser and get instant test feedback.

How exercises work →

Mentor AI

Script not doing what you expected? Ask right where you are

Automation code tends to fail quietly: a path that’s relative to the wrong folder, a glob that matches nothing, a PermissionError halfway through a batch of files.

Mentor AI sees the tutorial, lesson, or exercise you’re on and your code, and nudges you toward the fix one hint at a time, so you understand what your script is actually doing.

Meet Mentor AI →

The automation toolkit

Learn the tools that get the job done

Most of what you need ships with Python. The rest is a pip install away.

pathlib
Paths & files
shutil
Copy & move
subprocess
Run programs
argparse
CLI options
Click
CLI apps
Typer
Typed CLIs
Requests
HTTP & APIs
Beautiful Soup
Web scraping
Selenium
Browser automation
openpyxl
Excel files
pypdf
PDF files
smtplib
Sending email

Fresh from the library

New and updated for 2026

The Real Python team keeps publishing and refreshing automation content, so what you learn matches the tools and Python versions you’ll use every day.

Explore the standard library path →

Questions and answers

You should be comfortable with Python basics like variables, lists, loops, and functions. If you’re not there yet, the Python Basics learning path gets you ready, and many first automation scripts use nothing more than what it covers.

Mostly size and intent. A script is usually a single file that does one job, like tidying a folder. As you add options, error handling, and logging, it grows into a tool others can use. This roadmap covers both steps. To get comfortable running your code, start with How to Run Your Python Scripts and Code.

Start with argparse. It ships with Python, so your script runs anywhere without extra installs. When your tool grows several subcommands, Click and Typer save you a lot of boilerplate.

It depends on the site. Always check its terms of service and robots.txt, prefer an official API when one exists, and keep your request rate polite. The Python Web Scraping path covers these ground rules before you write your first scraper.

Every Real Python membership includes all video courses, quizzes, coding exercises, and learning paths for automation and every other topic, along with Mentor AI as it rolls out.

Stop doing it by hand

Get your free learning plan and follow the full scripting and automation roadmap, with courses, quizzes, coding exercises, and a mentor at your side.

Get your free learning plan