I'm using the argparse
module for this python project. I'm looking to get the available flags out of an ArgumentParser
object before calling parse_args()
. Anyone have any ideas?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Got this from the source code of add_argument():
I was trying to solve this the other day and I never got a satisfactory answer other than the following on from what @vvoody did.
The benefit is that it removes all the alias
-v
==--verbosity
etc. BUT if you changedest
for--verbosity
e.gdest='loud'
then it returnsloud
which may or may not be an issue.Seems an obvious thing for
argsparse
to provide out of the box.