Standard Library Overview
Python's "batteries included" standard library covers an enormous range of tasks — no pip install needed.
Data & Math
import math, statistics, decimal, fractions, random
print(math.factorial(10)) # 3628800
print(statistics.mean([1,2,3,4])) # 2.5
print(random.choice(["a","b","c"]))Date & Time
from datetime import datetime, timedelta, date
import time
now = datetime.now()
print(now.strftime("%Y-%m-%d %H:%M:%S"))
print(now + timedelta(days=7))OS & Files
import os, shutil, glob, tempfile
print(os.getcwd())
print(os.environ.get("HOME", "unknown"))
shutil.copy("src.txt", "dst.txt")Text & Data
import re, json, csv, textwrap, string
print(re.findall(r"\d+", "abc 123 def 456")) # ['123', '456']
print(textwrap.wrap("A very long line...", width=30))Networking & Web
import urllib.request, http.server, socket
from urllib.parse import urlparse, urlencode
result = urlparse("https://example.com/path?q=1")
print(result.netloc) # example.comConcurrency
import threading, multiprocessing, asyncio, concurrent.futures