python之脚本参数optparse
2016-04-26 18:07
393 查看
import optparse usage = "myprog[ -f <filename>][-s <xyz>] arg1[,arg2..]" opter=optparse.OptionParser(usage) opter.add_option("-f","--format",action="store_true",dest="format",help="format print") opter.add_option("-t", "--table", action="store", type="string", dest="table",help=u"输入一个表名") opter.add_option("-q", "--query", action="store", type="string", dest="term",help=u"查询的关键字") opter.add_option("-o", "--output", action="store", type="string", dest="outfile",help=u"输出文件") opt,args=opter.parse_args()
输入:-h
Options:
-h, --help show this help message and exit
-f, --format format print
-t TABLE, --table=TABLE
输入一个表名
-q TERM, --query=TERM
查询的关键字
-o OUTFILE, --output=OUTFILE
输出文件
相关文章推荐
- window的vnc客户端无法访问Linux服务端的问题之一
- 定义函数的方式,监控网站的存活状态
- Docker使用
- 在手指按下的位置弹出PopWindow
- Linux shell脚本输出日志笔记整理
- Linux C程序设计的一些小技巧
- linux:指令与档案的搜索
- recyclerview点击item弹出popupwindow
- linux:问题
- Linux下chkconfig命令例子与参数详解
- Hadoop的概念、版本、发展史
- 下拉菜单(二) PopupWindow 封装实现
- Docker--私有仓库构建--RHEL7.2
- 安装配置nginx
- Mysql 数据库升级shell脚本编写与测试心得
- CentOS中查看物理CPU信息的方法
- linux C语言获取本机ip地址
- linux /etc/profile 对空格敏感。。。。
- xshell 中 alt+. 快捷键无法使用
- Apache+PHP开发环境的配置