Modules for parsing command-line arguments

Python offers two modules for command-line argument parsing: getopt and optparse
These accept short options (-m) and long options (--mass)
getopt examines the command line and returns pairs of options and values ((--mass, 2.3))
optparse is a bit more comprehensive to use and makes the command-line options available as attributes in an object
In this introductory example we rely on manual parsing since this exemplifies basic Python programming

previousnexttable of contents