Python Standard Libraries¶
Python comes with a "batteries included" philosophy, meaning it has a rich set of built-in modules.
1. The math Module¶
Provides mathematical functions.
2. The os Module¶
Used for interacting with the operating system (files, folders, paths).
3. The random Module¶
Used for generating random numbers and choices.
4. The datetime Module¶
Used for working with dates and times.
5. The sys Module¶
Provides access to variables used or maintained by the interpreter.
6. The statistics Module¶
Mathematical statistics functions.
import statistics
data = [1, 2, 3, 4, 5, 5]
print(statistics.mean(data)) # 3.33
print(statistics.mode(data)) # 5
Searching for Modules
The official Python Module Index is the best place to find details on every built-in library.