On Jun 28, 11:47 pm, rantingrick <rantingr...@gmail.com> wrote: > Give your *script* an > enema, and do *yourself* a favor by harnessing the simplistic elegance > of the "optphart" module instead! > > #-- Start Script --# > def optphart(args): > d = {'args':[]} > for arg in args: > if arg.startswith('-'): > key, value = arg.split('=', 1) > options = value.split(',') > if len(options) > 1: > d[key[1:]] = options > else: > d[key[1:]] = [value] > else: > d['args'].append(arg) > return d
Probably I should not be answering this, but try to implement the parsing required by the OP with this approach, including the generation of the usage message and the error checking. Just try. M. S. -- http://mail.python.org/mailman/listinfo/python-list