python之脚本参数optparse
2024-08-26 01:47:04
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
输出文件
最新文章
- Android项目实战(二十六):蓝牙连接硬件设备开发规范流程
- 十天精通CSS3学习笔记 part2
- DevExpress .NET界面开发示例大全
- Mobile Assistant
- [ZZ] C++ pair
- 编译小结(6)认识Automake
- InterviewProblems
- 调bug时候应该提高思维深度(多问二十个为什么)
- 手把手教你如何加入到github的开源世界! (转)
- 转:运行yum报错Error: Cannot retrieve metalink for reposit
- j2se 总结
- checkbox对齐-复选框图标
- from表单校验插件 validate 实例
- WPF数字滚动效果
- Zookeeper安装及运行
- 1--常用linux命令
- Windows XP Manifest in Delphi
- 修改request请求参数
- 《深入浅出WPF》读书笔记
- Informatica 常用组件Lookup之一 概述
热门文章
- Nginx + tomcat 实现简单集群(基于反向代理方式)
- php--点赞功能的实现
- github 获取repo 发布的版本号
- hdu 2739(尺取法)
- LeetCode OJ-- Recover Binary Search Tree ***@
- ASP.NET MVC 实现 AJAX 跨域请求
- Codeforces 371E Subway Innovation (前缀和预处理应用)
- iOS 给三方日历加上农历
- Mac测试模拟慢网速
- [置顶]
 个人微信号发送zabbix告警信息