Next / Previous / Contents / Shipman's homepage

4.3. Modules required

litdocbook5
# - - - - -   I m p o r t s

To ease the future transition to Python 3.0, we'll use the new-style print function rather than the deprecated print statement. Python requires that imports from the __future__ module be placed before any other executable statement.

litdocbook5
from __future__ import print_function

The standard Python sys module gives programs access to their standard I/O streams and command line arguments.

litdocbook5
import sys

We use the standard third-generation Python argument processor.

litdocbook5
import argparse

XML handling uses a standard Python module. We'll refer to it within this script as just “et”.

litdocbook5
from xml.etree import ElementTree as et