Python Standard Library – POFTUT

Python Standard Library

Python is popular language where it provides a lot of features. These features provides easy ways to accomplish programming tasks. But only using Python language features is not enough to write successful applications. There is also big need for libraries. Libraries provides easy to to generic functions, classes, lists and various structures. Python Standard Library is builtin library which comes with python installation to provide different features. In this tutorial we popular use cases and features of Python Standard Library.

If you want to learn how to import following libraries and use them read following post.

Text Processing

Text processing is mainly related with string and text data. There is huge features in text processing libraries.

  • string library is used mainly common string operations.
  • re library is used for regular expression operations
  • readline library used to read values from user

Binary Data Services

As there is little need binary have little libraries and used to edit and convert binary data.

  • struct library is used to interpret bytes as packed binary data

Mathematical Libraries

Mathematics is important part of the applications development. Especially enterprise applications generally need heavy calculations and different mathematical equations. Hopefully Python Standard Library have huge support for this.

  • math library used for mathematical functions
  • cmath library is used for complex numbers
  • random is used for pseudo-numbers
  • statistics is used for mathematical statistics

File and Directory Access

File and directory access, manipulation and enumeration is another popular usage of libraries.

  • os.path library is used for common path name manipulations
  • stat library is used to interpret stats
  • pathlib library is used for object-oriented filesystem paths
LEARN MORE  Memcache Delete Operation with Python Example

Data Compression

There are different data or file compression formats like gzip, rar, lzma, zip etc. Support for these compression algorithms are provided with the libraries.

  • zlib
  • zgip
  • bz2
  • lzma
  • zipfile library used to work with zip files
  • tarfile library used to work with tar files

File Formats

There are different file formats supported by Python Standard Library.

  • csv library is used to read and write csv files
  • configparser library is used for configuration files

Cryptographic Services

Security is important part f the today computing. Python Standard Library also provides some of cryptographic services like below.

  • hashlib library is used for secure hashes and message digest
  • hmac library is used for keyed-hashing for message authentication
  • secrets library is used for generate secure randım numbers and secret management

Operating System

Operating system libraries provides a lot of features related time, argument parsing, curses etc.

  • os library is used for miscellaneous features
  • io library provides core tools for streams
  • time library is used for time access
  • logging is used for logging for system and related events
  • curses is used for terminal handling and character-cell displays

Inter-process and Network Communication

Communications between same and remote system processes and network communication is supported with the following libraries.

  • socket library is used for low-level networking interface
  • ssl library is used for ssl/tls
  • mmap library is use for memory-mapped file support
  • signal library is used for handlers for asynchronous events


Internet part of the PYthon Standard Library provides a lot of libraries. We will look most known of them.

  • webbrowser library is used as web-browser controller
  • cgi library provides Common Gateway Interface support
  • urllib is used for HTTP URL, Request, Response etc.
  • http
  • ftplib
  • poplib library provides POP3 support
  • smtplib provides SMTP support
  • ipaddress library is used for IPv4/IPv6 manipulation
LEARN MORE  Python Type Function with Examples


Multimedia provides multimedia related simple libraries

  • audioop library provides support for raw audio data manipulation
  • wave library supports WAV file read and write

Leave a Comment