Sea*_*ean -1 python syntax-error
我不断为以下代码得到相同的错误:
如果我要删除print语句,这是一个类似的错误
File "./MIcalc.py", line 31
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我知道它是说文件末尾有语法错误,但我不知道如何纠正它:/
我使用python 2.7并且第31行的任何代码行都存在错误
#!/usr/local/bin/python
DIR = '/home/sbird/lobSTR/output/output.txt'
def makeAlleleList(ALLREADS):
alleleList = []
ALLREADS_split = ALLREADS.split(";")
allele = [x.split("|") for x in ALLREADS_split]
[alleleList.append(x[0]) for x in allele]
return alleleList
def makeCovThresh(ALLREADS):
covThreshList = 0
ALLREADS_split = ALLREADS.split(";")
allele = [x.split("|") for x in ALLREADS_split]
for x in allele:
covThreshHold += int(x[1])
return covThreshList
f = open("write_MI_out.txt","w")
for line in open(DIR):
column = line.split("\t")
ALLREADS = column[2].split("'")
motherList = makeAlleleList(ALLREADS[1])
fatherList = makeAlleleList(ALLREADS[3])
sonList = makeAlleleList(ALLREADS[5])
covThresh = makeCovThresh(ALLREADS[5])
if len(sonList) < 3:
if set(motherList) & set(fatherList) & set(sonList):
f.write("{0} \n".format(covThresh)
print "wrote to file"
f.close()
print "Fin."
~
~
~
~
~
Run Code Online (Sandbox Code Playgroud)
f.write("{0} \n".format(covThresh)
Run Code Online (Sandbox Code Playgroud)
你在这里错过了一个括号.
f.write("{0} \n".format(covThresh))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2309 次 |
| 最近记录: |