From: Michele Simionato on 3 Aug 2010 01:28 On Aug 1, 1:08 pm, News123 <news1...(a)free.fr> wrote: > I wondered, whether there's a simple/standard way to let > the Optionparser just ignore unknown command line switches. > > thanks in advance for any ideas I will plug in my own work on plac: http://pypi.python.org/pypi/plac Your problem would be solved as follows: import plac @plac.annotations(test=('a flag', 'flag', 't')) def main(test, *ignore): print test, ignore if __name__ == '__main__': plac.call(main, ["-t","--ignoreme_and_dont_fail"])
First
|
Prev
|
Pages: 1 2 Prev: Docstrings and PEP 3174 Next: how can I solve this erorr usr/lib/python2.6 : permisson denied |