getopt

Parser for command line options.

This module helps scripts to parse the command line arguments in sys.argv. It supports the same conventions as the Unix getopt() function (including the special meanings of arguments of the form `-‘ and `–’). Long options similar to those supported by GNU software may be used as well via an optional third argument. This module provides two functions and an exception:

getopt() – Parse command line options gnu_getopt() – Like getopt(), but allow option and non-option arguments to be intermixed. GetoptError – exception (class) raised with ‘opt’ attribute, which is the option involved with the exception.

Functions

do_longs(opts, opt, longopts, args)
do_shorts(opts, optstring, shortopts, args)
getopt((args, options[, ...) Parses command line options and parameter list.
gnu_getopt(args, shortopts[, longopts]) getopt(args, options[, long_options]) -> opts, args
long_has_args(opt, longopts)
short_has_arg(opt, shortopts)

Exceptions

GetoptError(msg[, opt])
error alias of GetoptError