sys module - argv, but no argc ??
peter at engcorp.com
Sat Aug 3 14:57:43 CEST 2002
> I am sure that this isn't the most elegant way of parsing the command
> line, but it works well. And no index out of bounds errors, thus no
> need for argc.
> # Check to see if command line has any perimeters. -s is newserver,
> # -g is group. Range indexes manually, and allows the disregarding of
> # argv the way a slice would.
> import string
> import sys
You're probably right that it's not the most elegant way. The
most elegant way might be to use one of the existing modules,
perhaps getopt from the standard library, or Optik at
http://optik.sourceforge.net, and to avoid reinventing the wheel.
More information about the Python-list