General
Modules are pieces of code that other people have written to fulfill common tasks, such as generating random numbers, performing mathematical operations, etc. There are three main types of modules in Python, those you write yourself, those you install from external sources, and those that are preinstalled with Python. The last type is called the standard library, and contains many useful modules. Some of the standard library's useful modules include string, re, datetime, math, random, os, multiprocessing, subprocess, socket, email, json, doctest, unittest, pdb, argparse and sys.
Python 3 Module of the Week shows how to use the modules of the Python 3 standard library.
Many third-party Python modules are stored on the Python Package Index (PyPI).
The best way to install these is using a program called pip. It's important to enter pip commands at the command line, not the Python interpreter. The basic way to use a module is to add import module_name at the top of your code, and then using module_name.var to access functions and values with the name var in the module. Use a comma separated list to import multiple objects.
- Text Processing Services
- Functional Programming Modules
- DataTypes
- Numeric and Mathematical Modules
- 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
- File Management
- Fast IO
- OS.path — Common pathname manipulations
- glob — Unix style pathname pattern expansion
- shutil — High-level file operations
- PyFileSystem — Common interface to any filesystem.
- Data Persistence
- Graphic User Interface
- GUI with Tk
- emoji — Several ways to print emojis
- Interactivity with ipywidgets — Interactive browser controls for Jupyter notebooks
- Networking and Internet
- requests — HTTP for humans
- BeautifulSoup — Parsing HTML and XML documents
- Machine Learning
- Pandas — Read and manipulate data
- Numpy — Manipulating lists and tables of numerical data
- Numba — Makes Python code fast
- Matplotlib — For creating static, animated, and interactive visualizations in Python
- Scikit-learn — Machine learning in Python
- Parallel Computing
- Threads
- Processes
- Asyncio
- Development Tools
- Debugging and Profiling
- pdb — The Python debugger
- Time Profiling
- Memory Profiling
- Testing Software
- Logging
- Software Packaging and Distribution
- Debugging and Profiling