Skip to main content

Python Standard Libraries

Python Standard Libraries is a core Python concept covering python Standard Libraries: Python comes with a "batteries included This topic is essential for academic learning, board exam preparation, and developing optimized real-world code.

Python comes with a "batteries included" philosophy, meaning it has a rich set of built-in modules.

1. The math Module

Provides mathematical functions.

import math
print(math.sqrt(64)) # 8.0
print(math.pi) # 3.1415...

2. The os Module

Used for interacting with the operating system (files, folders, paths).

import os
print(os.getcwd()) # Current working directory
os.mkdir("new_folder")

3. The random Module

Used for generating random numbers and choices.

import random
print(random.randint(1, 10))
print(random.choice(["Red", "Blue", "Green"]))

4. The datetime Module

Used for working with dates and times.

import datetime
print(datetime.datetime.now())

5. The sys Module

Provides access to variables used or maintained by the interpreter.

import sys
print(sys.version)
print(sys.argv) # Command line arguments

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.

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir