Standard Libraries
Estimated study time: 9 minutes.
A standard library is a collection of pre-written code — functions, classes, and modules — that ships with a programming language by default. Instead of writing common functionality like file handling, string manipulation, or date formatting from scratch, developers simply import it from the standard library.
Why Standard Libraries Matter
Standard libraries save time, reduce bugs, and enforce consistency. Because the code is tested and maintained by the language's core team or community, it's generally more reliable than a custom implementation of the same feature.
What's Typically Included
- File and I/O handling utilities
- Data structures like lists, dictionaries, and sets
- String and text processing tools
- Date and time utilities
- Networking and basic HTTP support
Example
import math
import datetime
print(math.sqrt(16)) # 4.0
print(datetime.date.today()) # current date
In this example, both math and datetime are part of Python's standard library — no external installation is needed.