pytutorial/python_basics/standard_libraries
David Rotermund 46254faf30
Update README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
2023-12-11 11:42:09 +01:00
..
README.md Update README.md 2023-12-11 11:42:09 +01:00

The Python Standard Library

{:.no_toc}

* TOC {:toc}

The goal

More than the standard instruction set...

Questions to David Rotermund

Text Processing Services

The modules described in this chapter provide a wide range of string manipulation operations and other text processing services.

string Common string operations
re Regular expression operations
difflib Helpers for computing deltas
textwrap Text wrapping and filling
unicodedata Unicode Database
stringprep Internet String Preparation
readline GNU readline interface
rlcompleter Completion function for GNU readline

Binary Data Services

The modules described in this chapter provide some basic services operations for manipulation of binary data. Other operations on binary data, specifically in relation to file formats and network protocols, are described in the relevant sections.

struct Interpret bytes as packed binary data
codecs Codec registry and base classes

Data Types

The modules described in this chapter provide a variety of specialized data types such as dates and times, fixed-type arrays, heap queues, double-ended queues, and enumerations.

datetime Basic date and time types
zoneinfo IANA time zone support
calendar General calendar-related functions
collections Container datatypes
collections.abc Abstract Base Classes for Containers
heapq Heap queue algorithm
bisect Array bisection algorithm
array Efficient arrays of numeric values
weakref Weak references
types Dynamic type creation and names for built-in types
copy Shallow and deep copy operations
pprint Data pretty printer
reprlib Alternate repr() implementation
enum Support for enumerations
graphlib Functionality to operate with graph-like structures

Numeric and Mathematical Modules

The modules described in this chapter provide numeric and math-related functions and data types. The numbers module defines an abstract hierarchy of numeric types. The math and cmath modules contain various mathematical functions for floating-point and complex numbers. The decimal module supports exact representations of decimal numbers, using arbitrary precision arithmetic.

numbers Numeric abstract base classes
math Mathematical functions
cmath Mathematical functions for complex numbers
decimal Decimal fixed point and floating point arithmetic
fractions Rational numbers
random Generate pseudo-random numbers
statistics Mathematical statistics functions

Functional Programming Modules

The modules described in this chapter provide functions and classes that support a functional programming style, and general operations on callables.

itertools Functions creating iterators for efficient looping
functools Higher-order functions and operations on callable objects
operator Standard operators as functions

File and Directory Access

The modules described in this chapter deal with disk files and directories. For example, there are modules for reading the properties of files, manipulating paths in a portable way, and creating temporary files.

pathlib Object-oriented filesystem paths
os.path Common pathname manipulations
fileinput Iterate over lines from multiple input streams
stat Interpreting stat() results
filecmp File and Directory Comparisons
tempfile Generate temporary files and directories
glob Unix style pathname pattern expansion
fnmatch Unix filename pattern matching
linecache Random access to text lines
shutil High-level file operations

Data Persistence

The modules described in this chapter support storing Python data in a persistent form on disk. The pickle and marshal modules can turn many Python data types into a stream of bytes and then recreate the objects from the bytes. The various DBM-related modules support a family of hash-based file formats that store a mapping of strings to other strings.

pickle Python object serialization
copyreg Register pickle support functions
shelve Python object persistence
marshal Internal Python object serialization
dbm Interfaces to Unix “databases”
sqlite3 DB-API 2.0 interface for SQLite databases

Data Compression and Archiving

The modules described in this chapter support data compression with the zlib, gzip, bzip2 and lzma algorithms, and the creation of ZIP- and tar-format archives. See also Archiving operations provided by the shutil module.

zlib Compression compatible with gzip
gzip Support for gzip files
bz2 Support for bzip2 compression
lzma Compression using the LZMA algorithm
zipfile Work with ZIP archives
tarfile Read and write tar archive files