Message108842
| Author |
iElectric |
| Recipients |
bethard, eric.smith, georg.brandl, iElectric, r.david.murray |
| Date |
2010年06月28日.17:04:52 |
| SpamBayes Score |
0.06616741 |
| Marked as misclassified |
No |
| Message-id |
<1277744694.62.0.489884119317.issue9077@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I always used optparse like this, using the rargs (maybe this is not main intention, but worked so far):
>>> import optparse
>>> parser = optparse.OptionParser()
>>> parser.add_option('--test', action='store_true')
<Option at 0x7f55bdb32dd0: --test>
>>> parser.parse_args(['--test', 'foo', 'foo1', '--', 'foo2', 'foo3'])
(<Values at 0x7f55bda89170: {'test': True}>, ['foo', 'foo1', 'foo2', 'foo3'])
>>> parser.rargs
['foo2', 'foo3']
>>> parser.largs
['foo', 'foo1'] |
|