Message99443
| Author |
amcnabb |
| Recipients |
amcnabb, pycurry |
| Date |
2010年02月16日.22:24:52 |
| SpamBayes Score |
6.7712867e-06 |
| Marked as misclassified |
No |
| Message-id |
<1266359094.39.0.851552986764.issue5088@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think that optparse is doing the right thing here. I think that your code example should be changed to:
import optparse
parser = optparse.OptionParser()
parser.add_option("-o", "--option", action = "append")
options, args = parser.parse_args()
if not options.option:
options.option = ['a']
print options
Think of the default as the initial list, and each time the -o option is specified, an item is appended to that initial list. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年02月16日 22:24:54 | amcnabb | set | recipients:
+ amcnabb, pycurry |
| 2010年02月16日 22:24:54 | amcnabb | set | messageid: <1266359094.39.0.851552986764.issue5088@psf.upfronthosting.co.za> |
| 2010年02月16日 22:24:52 | amcnabb | link | issue5088 messages |
| 2010年02月16日 22:24:52 | amcnabb | create |
|