There was a question that asked where they come from, and the accepted answer was a bunch of links to tutorials and source code.
Explanation for argparse python modul behaviour: Where do the capital placeholders come from?
None of it was helpful to me, I want to either get rid of them, or know their purpose.
For example, a line like this:
parser.add_argument('-c', '--chunksize', type=int, help='chunk size in bits')
produces garbage like this:
optional arguments:
-h, --help show this help message and exit
-c CHUNKSIZE, --chunksize CHUNKSIZE
chunk size in bits
and if I try with an empty metavar string:
parser.add_argument('-c', '--chunksize', metavar='', type=int, help='chunk size in bits')
I get a space after the comma:
optional arguments:
-h, --help show this help message and exit
-c , --chunksize chunk size in bits
解决方案parser.add_argument('-c', '--chunksize', metavar='\b', type=int, help='chunk size in bits')
seems to work