5.1. Import statements

One of the strongest motivations for using Python is that it provides variety of tools for data collection and data management.

But almost none of these tools are present when Python starts up. They are defined in modules which must be loaded into Python with an import statement, which looks like this:

import re

This command imports the Python re module. The initials “re” stand for regular expressions. Regular expressions are pattern matching expressions with wild cards used to search for and extract particular kinds of expressions from texts.

We will be learning more about the regular expressions module when we turn to text processing. For now, let’s discuss what happens when an import statement like the one above is executed, and how your program can take advantage of it.