0
- 采取argparse参数,
- 测试,如果这样的说法是真实的
- 如果是真的,写一个文件在命令行 :
这样的说法
例如后指定的名称
$蟒蛇printfile.py --out_arg fileOutput.txt
...会产生fileOutput.txt在同一目录printfile.py
代码:
def parse_arguments():
options = parse_arguments()
#output arguments
parser.add_argument("--out_arg", action='store', default=False, dest='out_arg',
help="""Output file """)
def print_output(seqID, seq, comm):
# "a" append is used since this is the output of a for loop generator
if options.out_arg
outputfh = open(options.out_33,"a")
outputfh.write("@{}\n{}\n{}\n+".format(seqID, seq, comm))
else:
sys.stderr.write("ERR: sys.stdin is without sequence data")
然而, ,当我从def main()中调用print_output(未显示)传递感兴趣的元组(seqID,seq,comm)时,没有写入文件,也没有给出错误消息。它是不是将输入文件存储为dest的argparse参数?尝试写入时是否使用文件句柄?
什么是'options.out_33'在这里? – 2014-10-17 18:20:56
并且'print_output'实际*被调用*? – 2014-10-17 18:21:23
是什么实际上称为? – 2014-10-17 18:23:57