0

使用TreeTagger时出现以下问题

import os
os.system("bin/tree-tagger lib/english-utf8.par inputfile outputfile")

上面的代码片段在命令行中工作。但是当我尝试在 python 代码中执行它时,即使给出了任何错误,输出文件中也没有写入任何内容。

4

1 回答 1

0

这是我使用 cmd 在我不久前在 python 2.7 中编写的程序中包含命令行的方式。显然,您将不得不更改您的数据类型。

`import sys, os, subprocess
def velvet_assembly(fastqs,output):

    #cmd is a command line within the programme#
    cmd=['velveth', output, '59', '-fastq.gz', '-shortPaired',fastqs[0],fastqs[1]]
    my_file=subprocess.Popen(cmd)
    my_file.wait()
velvet_assembly(fastqs,output)`

在此链接中,您可以获得其他一些示例。[ https://www.cyberciti.biz/faq/python-run-external-command-and-get-output/][1]

希望这是有用的。

于 2018-06-20T15:31:21.667 回答