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.
http://www.poftut.com/python-modules-tutorial-examples/
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 operationsreadline
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 functionscmath
library is used for complex numbersrandom
is used for pseudo-numbersstatistics
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 manipulationsstat
library is used to interpret statspathlib
library is used for object-oriented filesystem paths
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 filestarfile
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 filesconfigparser
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 digesthmac
library is used for keyed-hashing for message authenticationsecrets
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 featuresio
library provides core tools for streamstime
library is used for time accesslogging
is used for logging for system and related eventscurses
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 interfacessl
library is used for ssl/tlsmmap
library is use for memory-mapped file supportsignal
library is used for handlers for asynchronous events
Internet
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 controllercgi
library provides Common Gateway Interface supporturllib
is used for HTTP URL, Request, Response etc.http
ftplib
poplib
library provides POP3 supportsmtplib
provides SMTP supportipaddress
library is used for IPv4/IPv6 manipulation
Multimedia
Multimedia provides multimedia related simple libraries
audioop
library provides support for raw audio data manipulationwave
library supports WAV file read and write