The argparse module includes tools for building command line argument and option processors. It was added to Python 2.7 as a replacement for optparse . The implementation of argparse supports features that would not have been easy to add to optparse , and that would have required backwards-incompatible API changes, so a new module was brought into the library instead. optparse is now deprecated.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.