understanding sys.argv[]
Peter Hansen
peter at engcorp.com
Wed Aug 14 21:32:59 EDT 2002
Don Low wrote:
>
> OK, so if I understand correctly, I'd have something like this
>
> opts, args = getopt.getopt(sys.argv[1:], "i:")
>
> Not sure why 2 variables (opts and args) get initialized with getopt...
But you *did* read the documentation first, right? :)
http://www.python.org/doc/current/lib/module-getopt.html tells all...
I quote:
"The return value consists of two elements: the first is a list
of (option, value) pairs; the second is the list of program arguments
left after the option list was stripped (this is a trailing slice of args)."
In context that is even clearer...
-Peter
More information about the Python-list
mailing list