Python Modules & Packages
Python Standard Library
The Python standard library is a huge collection of ready-made modules that ship with every Python install — no pip required — covering everything from math to file handling to dates.
"Batteries Included"
Python's official philosophy is often summed up as "batteries included" — meaning the moment you install Python, you already have hundreds of useful modules ready to import, without needing pip or an internet connection. This is a huge productivity boost for beginners and professionals alike.
Why This Matters
Instead of writing your own code to generate random numbers, work with dates, or read JSON data, you simply import the relevant module and call well-tested functions that the whole Python community relies on. This saves time and avoids bugs you would otherwise introduce yourself.
A Quick Tour
Below are some of the most commonly used standard library modules you will meet as a beginner, each covered in more depth in their own tutorials.
| Module | Used For |
|---|---|
| os | Interacting with the operating system: files, folders, paths, environment variables |
| sys | Command-line arguments, exiting a script, interpreter settings |
| math | Mathematical functions like square root, power, floor, ceiling, constants |
| random | Generating random numbers, random choices, shuffling |
| json | Converting between Python objects and JSON text for APIs and files |
| datetime | Working with dates, times, and time differences |
import os
import random
import datetime
print(os.getcwd())
print(random.randint(1, 6))
print(datetime.date.today())Standard Library vs Third-Party Packages
Modules like os, sys, math, random, json, and datetime come built in. Libraries such as pandas or requests are third-party — they must be installed with pip first, since they are not part of the standard library.
Before installing a third-party package for a task, check if the standard library already solves it — it usually does, and it needs zero installation.
Each of these modules deserves its own deep dive; the following tutorials in this series walk through os, sys, math, random, json, and datetime individually with plenty of practical examples.
