- publishing free software manuals
An Introduction to Python
by Guido van Rossum and Fred L. Drake, Jr.
Paperback (6"x9"), 124 pages
ISBN 0954161769
RRP £12.95 ($19.95)

Sales of this book support the Python Software Foundation! Get a printed copy>>>

10.3 Command Line Arguments

Common utility scripts often need to process command line arguments. These arguments are stored in the ‘sys’ module's argv attribute as a list. For instance the following output results from running ‘python demo.py one two three’ at the command line:

    >>> import sys
    >>> print sys.argv
    ['demo.py', 'one', 'two', 'three']

The ‘getopt’ module processes sys.argv using the conventions of the UNIX getopt() function. More powerful and flexible command line processing is provided by the ‘optparse’ module.

ISBN 0954161769An Introduction to PythonSee the print edition