Saturday, 15 August 2015

syntax error - Python SyntaxError at end of code -



syntax error - Python SyntaxError at end of code -

i maintain getting same error next code:

here similar error if delete print statement

file "./micalc.py", line 31 ^ syntaxerror: invalid syntax

i know saying there syntax error @ end of file, have no thought how right it:/

i using python 2.7 , error persists line of code @ line 31

#!/usr/local/bin/python dir = '/home/sbird/lobstr/output/output.txt' def makeallelelist(allreads): allelelist = [] allreads_split = allreads.split(";") allele = [x.split("|") x in allreads_split] [allelelist.append(x[0]) x in allele] homecoming allelelist def makecovthresh(allreads): covthreshlist = 0 allreads_split = allreads.split(";") allele = [x.split("|") x in allreads_split] x in allele: covthreshhold += int(x[1]) homecoming covthreshlist f = open("write_mi_out.txt","w") 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 file" f.close() print "fin." ~ ~ ~ ~ ~

f.write("{0} \n".format(covthresh)

you're missing parenthesis here.

f.write("{0} \n".format(covthresh))

python syntax-error

No comments:

Post a Comment