Peter Hansen wrote:
> I think you could just use getopt or optparse, passing in each line
> after doing a simple .split() on it. The resulting handling of the
> arguments would be much simpler and cleaner than what you have.
>
> That won't work perfectly well if you can have quoted arguments with
> spaces in them, however, but the example above does not.
shlex.split() may help with the splitting, e. g.:
>>> shlex.split("alpha beta --gamma 'delta epsilon' zeta\\ eta\n")
['alpha', 'beta', '--gamma', 'delta epsilon', 'zeta eta']
Peter
--
http://mail.python.org/mailman/listinfo/python-list