Module (Python)

A module is a file of Python code, usually ending in .py, that other files can import. Importing a module gives you access to its functions, classes, and variables.

Python

Python's standard library is a large collection of modules that come with Python, such as math, random, and datetime. A folder of modules is called a package.

Examples

Python

import math
print(math.sqrt(16))

Output:

4.0

Learn it in a lesson

See also

Back to the Dictionary