Skip to content


Modules encapsulate a set of features whether it be of the language or of third-party software.

There are multiple ways to import modules:

  1. Import using the module name
import re

my_regex = re.compile("[0-9]+", re.I)
  1. Access module using an alias
import matplotlib.pyplot as plt
  1. Import specific values from the module
from matplotlib import pyplot as plt

Users should avoid importing modules using * to avoid overriding local variables.

from matplotlib import * #AVOID DOING THIS IF POSSIBLE!