OptionParser
给个例子:
from optparse import OptionParser
msg_usage = 'usage: %prog [-W] windows size [-H] h island size [-I] input your map file [-O] output file name'
descr = '''Correct SNPs used for constructing genetic map...
Why default h_size is 6?
Fistly, for example, aaaaaaaaaaaaaaaabbbbbbbbbbbbbb will generate 6 h.
secondly, for examplem aaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhaaaaaaaaaa will generate at least 7 when num
of h larger than 9, when num of h is 5-8, no h will be generated.
Caveat: default was setted 6 above when the window size is 15.
The question still not settled yet is what the size of h will be seted when windows size is
not 15...
'''
optparser = OptionParser(usage = msg_usage, description = descr)
optparser.add_option('-W', '--win_size', dest = 'winsize', default = 15,
help = 'The size of sliding window, default is 15.')
optparser.add_option('-H', '--h_island', dest = 'hisland', default = 6,
help = 'The length of h_island you need to split, default\
is 6')
optparser.add_option('-I', '--input', dest = 'inputfile',
help = 'Input your file need to tackle')
optparser.add_option('-O', '--output', dest = 'outputfile',
help = 'Your output file name')
options, args = optparser.parse_args()
if __name__ == "__main__":
W = int(options.winsize)
H = int(options.hisland)
I = options.inputfile
O = options.outputfile
main(I, W, H, O)
by freemao
FAFU
free_mao@qq.com
OptionParser的更多相关文章
- Python中optionParser模块的使用方法[转]
本文以实例形式较为详尽的讲述了Python中optionParser模块的使用方法,对于深入学习Python有很好的借鉴价值.分享给大家供大家参考之用.具体分析如下: 一般来说,Python中有两个内 ...
- Python OptionParser学习
from optparse import OptionParser import sys def main(): p = OptionParser() p.add_option('-n','--nam ...
- 转-Python optionParser模块的使用方法
Python 有两个内建的模块用于处理命令行参数: 一个是 getopt,<Deep in python>一书中也有提到,只能简单处理 命令行参数: 另一个是 optparse,它功 ...
- Python的参数模块OptionParser说明
可以替代getopt的一个模块 from optparse import OptionParser # 生成一个实例 parser = OptionParser(usage="%prog ...
- python基础之 optparse.OptionParser
optparse是专门用来在命令行添加选项的一个模块. 首先来看一段示例代码 from optparse import OptionParser MSG_USAGE = "myprog[ - ...
- python OptionParser模块
Python中强大的选项处理模块. #!/usr/bin/python from optparse import OptionParser parser = OptionParser() parser ...
- python中的optionParser模块
Python 有两个内建的模块用于处理命令行参数:一个是 getopt,<Deep in python>一书中也有提到,只能简单处理 命令行参数:另一个是 optparse,它功能强大,而 ...
- OptionParser命令参数介绍及使用
使用optionParse解析命令行参数分以下几个步骤: 创建parser实例 使用add_option添加我们要处理的命令行参数 得到解析sys.argv后的options对象,查看用户的输入 代码 ...
- Python模块: 命令行解析optionparser
Python 有两个内建的模块用于处理命令行参数:一个是 getopt,<Deep in python>一书中也有提到,只能简单处理 命令行参数:另一个是 optparse,它功能强大,而 ...
随机推荐
- Ubuntu里面的安装命令总结
本人是新手中的新手,才开始用ubuntu.下面,总结一下安装软件的方法...... 0. 利用apt-get 其实,在ubuntu下安装软件的方法其实灰常简单.就是在终端里面输入: sudo apt- ...
- Java爬虫,信息抓取的实现
转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/23272657 今天公司有个需求,需要做一些指定网站查询后的数据的抓取,于是花了点 ...
- invalid types 'int[int]' for array subscrip
定义重复 如 一个int r 与一个 r[i] 重复
- Android EditText email、数字验证
在做Android注册登录模块的时候,经常需要在客户端就验证用户输入的信息的正确性,如填写邮箱需要验证是否是邮箱,填写手机.年龄等信息需要验证是否是数字.先介绍一下验证邮箱的代码: /** * met ...
- C# Inject
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Di ...
- JDBC体会
1.把mysql-connector XXXX版本导入buildpath 2.通过DriverManager 的getConnection 方法获得一个Connnection引用,方法的参数是 url ...
- JavaScript基础--超级玛丽(七)(上下左右控制)
相信大家都玩过超级玛丽,下面实现控制玛丽的上.下.左.右等基本功能,本篇只是在练习JavaScript的用法 1.创建一个HTML页面 <!doctype html> <html l ...
- lightoj1038
//Accepted 2860 KB 16 ms //概率 //对于n,假设n变成1的期望步数为p(n) //则p(n)=1/t*sum((1+p(d))) d|n //解得:p(n)=1/(t-1) ...
- iOS 三种录制视频方式
随着每一代 iPhone 处理能力和相机硬件配置的提高,使用它来捕获视频也变得更加有意思.它们小巧,轻便,低调,而且与专业摄像机之间的差距已经变得非常小,小到在某些情况下,iPhone 可以真正替代它 ...
- Android SurfaceView vs TextureView
Android SurfaceView vs TextureView https://github.com/crosswalk-project/crosswalk-website/wiki/Andro ...