标签:
click:
官方主页:http://click.pocoo.org/5/
支持:
1 命令的任意嵌套 2 自动生成帮助信息 3 支持在运行时子命令的延迟加载
安装:
pip install click
例子:
import click @click.command() @click.option(‘--count‘, default=1, help=‘Number of greetings.‘) @click.option(‘--name‘, prompt=‘Your name‘, help=‘The person to greet.‘) def hello(count, name): """Simple program that greets NAME for a total of COUNT times.""" for x in range(count): click.echo(‘Hello %s!‘ % name) if __name__ == ‘__main__‘: hello()
运行:
$ python hello.py --help Usage: hello.py [OPTIONS] Simple program that greets NAME for a total of COUNT times. Options: --count INTEGER Number of greetings. --name TEXT The person to greet. --help Show this message and exit.
参考:
http://www.thinksaas.cn/topics/0/346/346148.html
标签:
原文地址:http://www.cnblogs.com/persuit/p/5602625.html