getopt — Command Line Option Parsing — PyMOTW 3
The getopt module is the original command line option parser that supports the conventions established by the Unix function getopt() . It parses an argument sequence, such as sys.argv and returns a sequence of tuples containing (option, argument) pairs and a sequence of non-option arguments.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.