Python Standard Library - Real Python
Python Standard Library Modules
By leveraging Python's extensive standard library , you can ship scripts and services without extra dependencies. In these tutorials, you learn practical patterns for datetime, pathlib, collections, itertools, functools, argparse, logging, subprocess, json, and more. You get step-by-step examples, common pitfalls, and performance tips so you can write clean, fast, and idiomatic code.
Join Now: Click here to join the Real Python Newsletter and you'll never miss another Python tutorial, course, or news update.
You see when to choose each module, how to combine them, and how to build cross-platform tools and tests. You also practice debugging and profiling with traceback, pdb, timeit, and unittest, plus modern typing with typing and dataclasses to keep your code safe and maintainable.
Browse all resources below, or commit to a guided Learning Path with progress tracking:
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
Use pathlib.Path for readable, cross-platform paths. Join with /, iterate with .glob(), and read or write using .read_text() and .write_text().
Load JSON from text with json.loads() or from files with json.load(). Serialize with json.dumps() or json.dump() and set indent=2 for pretty output. Validate keys using typing.TypedDict or dataclasses where helpful.
Yes, use argparse . Define a parser, call .add_argument(), then parse_args() to get typed values and automatic --help output.
Call subprocess.run([...], check=True, capture_output=True, text=True) . Pass the command as a list of arguments to avoid invoking the shell. Use pathlib.Path objects for any file paths. Handle errors with subprocess.CalledProcessError.
Use datetime for time arithmetic, zoneinfo for IANA time zones and timezone.utc for UTC. Parse with .fromisoformat() and format with .strftime().
Not sure where to start? Mentor AI can put these tutorials in an order that fits what you already know.
Ask Mentor AI
- Pick a question and Mentor AI takes it from here.
- Suggest a learning order
- Is there a learning path for this?
- Ask something else...
Common Python Data Structures (Guide)
Dec 06, 2026 basics data-structures python stdlib
Python Timer Functions: Three Ways to Monitor Your Code
Dec 06, 2026 intermediate python stdlib
Data Classes in Python (Guide)
Dec 05, 2026 intermediate python stdlib
How to Launch an HTTP Server in One Line of Python Code
Dec 04, 2026 intermediate stdlib web-dev
The Walrus Operator: Python's Assignment Expressions
Dec 04, 2026 intermediate best-practices stdlib
Working With JSON Data in Python
Dec 04, 2026 intermediate python stdlib
Python sleep(): How to Add Time Delays to Your Code
Dec 03, 2026 intermediate stdlib
Python itertools By Example
Dec 03, 2026 advanced python stdlib
The Python heapq Module: Using Heaps and Priority Queues
Dec 02, 2026 intermediate data-structures python stdlib
The Real Python Podcast - Episode #320: Optimizing Python Performance & Building a Django Static Site
Nov 27, 2026 intermediate django stdlib web-dev
Python Timer Functions: Three Ways to Monitor Your Code
Nov 27, 2026 intermediate python stdlib
Exploring the Python math Module
Nov 19, 2026 intermediate python stdlib
Socket Programming in Python (Guide)
Oct 31, 2026 advanced python stdlib web-dev
Learn With Mentor AI: A Guided Journey Through Async Python
Oct 29, 2026 intermediate stdlib
Learn With Mentor AI: A Guided Journey Through Async Python
Oct 29, 2026 intermediate stdlib
Build Command-Line Interfaces With Python's argparse
Oct 26, 2026 intermediate python stdlib
Sorting a Python Dictionary: Values, Keys, and More
Oct 25, 2026 intermediate data-structures stdlib
Logging in Python
Oct 25, 2026 intermediate best-practices stdlib tools
Python Debugging With Pdb
Oct 25, 2026 intermediate stdlib tools
Python's pathlib Module: Taming the File System
Oct 25, 2026 intermediate python stdlib
Python Debugging With Pdb
Oct 25, 2026 intermediate stdlib tools
Python's pathlib Module: Taming the File System
Oct 25, 2026 intermediate python stdlib
Python Threading
Oct 24, 2026 advanced python stdlib
Working With JSON Data in Python
Oct 24, 2026 intermediate python stdlib
Python itertools By Example
Oct 22, 2026 advanced python stdlib
Python itertools By Example
Oct 21, 2026 advanced python stdlib
Python itertools By Example
Oct 21, 2026 advanced python stdlib
How to Get a List of All Files in a Directory With Python
Oct 10, 2026 intermediate stdlib
How to Launch an HTTP Server in One Line of Python Code
Oct 05, 2026 intermediate stdlib web-dev
Python's collections: A Buffet of Specialized Data Types
Oct 04, 2026 intermediate data-structures python stdlib
The Real Python Podcast - Episode #313: Python 3.15: Exploring the New Features
Oct 02, 2026 intermediate best-practices data-structures stdlib
The Beginner's Guide to Python Turtle
Oct 02, 2026 basics python stdlib
How to Copy Objects in Python: Shallow vs Deep Copy Explained
Sep 27, 2026 advanced python stdlib
The subprocess Module: Wrapping Programs With Python
Sep 11, 2026 intermediate devops stdlib
Python Timer Functions
Sep 08, 2026 intermediate python stdlib
Python Timer Functions
Sep 08, 2026 intermediate python stdlib
Common Python Data Structures (Guide)
Sep 04, 2026 basics data-structures python stdlib
Working With Python's deque
Aug 18, 2026 intermediate data-structures python stdlib
Working With Python's deque
Aug 18, 2026 intermediate data-structures python stdlib
The Real Python Podcast - Episode #305: Should You Understand Your Entire Python Codebase?
Jul 31, 2026 intermediate best-practices community django stdlib
Build Enumerations of Constants With Python's Enum
Jul 09, 2026 intermediate data-structures python stdlib
The Real Python Podcast - Episode #301: Running Python Locally in a Sandbox
Jul 03, 2026 intermediate ai community django stdlib
Sorting a Python Dictionary: Values, Keys, and More
Jun 18, 2026 intermediate data-structures stdlib
Important Standard Library Modules
May 26, 2026 intermediate python stdlib
The Real Python Podcast - Episode #296: Managing Polars Schema Issues & Profiling GitHub Users
May 22, 2026 intermediate best-practices community data-science stdlib
Python's Array: Working With Numeric Data Efficiently
May 15, 2026 intermediate data-structures stdlib
Testing Your Code With Python's unittest
Apr 28, 2026 intermediate stdlib testing
Testing Your Code With Python's unittest
Apr 28, 2026 intermediate stdlib testing
Share Feedback