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.