Introduction to Wagtail | Coders of Colour

Modules

A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand and use. A module is a Python object with arbitrarily named attributes that you can bind and reference.

Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.

There are several pre-programmed modules in Python to help with common tasks. These modules make the Standard Library.

Import a module

To use functions from a module in your programme, you need to import it into your file.

To do that, use the command "import" :

import os
import codecs

List of standard modules

The most important modules in the Standard Library are:

Edit this page on GitHub