Fundamentals 5 min read

Common Python Standard and Third‑Party Libraries with Usage Examples

This article lists essential Python standard libraries and popular third‑party packages, explains their primary functions, and provides concise code examples for modules such as datetime, zlib, and sys to help developers quickly understand and apply them in their projects.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Common Python Standard and Third‑Party Libraries with Usage Examples

The article presents a collection of frequently used Python standard libraries—including datetime , zlib , random , math , sys , glob , and os —and describes each library's main purpose.

It also lists common third‑party libraries such as Scrapy , Requests , Pillow , matplotlib , OpenCV , pytesseract , wxPython , Twisted , SymPy , SQLAlchemy , SciPy , NumPy , nose , nltk , IPython , and BeautifulSoup , briefly noting their typical use cases.

Below are practical usage examples for several standard modules.

datetime module example:

from datetime import date
# import time library
now = date.today()
print(now)
birthday = date(1987, 12, 3)
print(birthday)
age = now - birthday
print(age)

Running this code prints the current date, a specific birthday, and the calculated age in days.

zlib module example:

import zlib
m = b'This is a test compress'
print(m)
m1 = len(m)
print(m1)
t = zlib.compress(m)
t1 = len(t)
print(t)
print(t1)
s = zlib.decompress(t)
print(s)

This snippet demonstrates compressing a byte string, checking lengths before and after compression, and then decompressing back to the original data.

sys module example:

import sys
a = sys.path
print(a)

The code prints the list of directories that Python searches for modules, showing the current environment's import paths.

Pythonprogrammingcode examplesstandard-libraryThird-Party Libraries
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.