Explanation for argparse python modul behaviour: Where do the capital placeholders come from?

蹲街弑〆低调 提交于 2019-12-01 19:07:56

Here are a couple basic argparse resources I dug up:

Some slides on argparse: http://www.slideshare.net/tisto/argparse-python-command-line-parser

A little argparse example: http://www.rutherfurd.net/tag/argparse/

Here is a real-world argparse example: https://github.com/harijay/xtaltools/blob/e683fcef6a5ad7394b87382e58d4dce32a85585b/maskconvert.py

As far as avoiding pitfalls, here is a nice looking wrapper for argparse to reduce the boilerplate code you have to write for some common usecases: http://travelingfrontiers.wordpress.com/2010/11/03/simple-python-argparse-wrapper/

The capital letter items are just value placeholders; they're taken from the destination of the option. You can specify alternative placeholders via the metavar= param of add_argument:

http://docs.python.org/dev/library/argparse.html#metavar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!