Message415097
'-1' and '-1.23' are recognized as numbers, and treated as arguments. '-1' requires some special handling because it is allowed as a flag, as in
parser.add_argument('-1','--one')
'-1:00' on the other hand is no different from a string like '-foo'. Default is to parse it as a flag. If you don't get this error
argument -f: expected one argument
you are likely to get:
error: unrecognized arguments: -1:23
This can probably be closed as a duplicate of:
https://bugs.python.org/issue9334
argparse does not accept options taking arguments beginning with dash (regression from optparse) |
|
Date |
User |
Action |
Args |
2022-03-13 20:39:33 | paul.j3 | set | recipients:
+ paul.j3, rhettinger, eric.smith, xtreak, Pythass |
2022-03-13 20:39:33 | paul.j3 | set | messageid: <1647203973.91.0.452197067849.issue47002@roundup.psfhosted.org> |
2022-03-13 20:39:33 | paul.j3 | link | issue47002 messages |
2022-03-13 20:39:33 | paul.j3 | create | |
|