Message243447
| Author |
bobjalex |
| Recipients |
bobjalex |
| Date |
2015年05月18日.01:22:11 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1431912132.53.0.00377060178324.issue24223@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Here is simple example of failure to parse arguments that should parse OK. In the following little program, the second from last line contains an aargument sequence that parses OK, but the last line should but doesn't.
import argparse
ap = argparse.ArgumentParser()
ap.add_argument("--option", action="store_true")
ap.add_argument("arg_1")
ap.add_argument("arg_2", nargs="?")
print("test 1:", ap.parse_args(["abc", "mmm", "--option"]))
print("test 2:", ap.parse_args(["abc", "--option", "mmm"])) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年05月18日 01:22:12 | bobjalex | set | recipients:
+ bobjalex |
| 2015年05月18日 01:22:12 | bobjalex | set | messageid: <1431912132.53.0.00377060178324.issue24223@psf.upfronthosting.co.za> |
| 2015年05月18日 01:22:12 | bobjalex | link | issue24223 messages |
| 2015年05月18日 01:22:11 | bobjalex | create |
|