无法运行.py文件,但python中的所有代码都是vaild

时间:2017-01-31 12:35:58

标签: python biopython

from Bio import SeqIO
import re, os
import pandas as pd
from Bio.Seq import Seq
from Bio.Alphabet import generic_dna
from Bio.SeqRecord import SeqRecord
os.chdir('c:\\Users\Workspace\\Desktop')

f_out = os.path.join(os.getcwd(),'convertedgisaid','pandemic2009.txt')
fileNameStruct = "pandemic2009p"
fileCount = 0
fout = open(f_out,'w')
number_of_files = 5

while(fileCount<number_of_files): 
 f_in = os.path.join(os.getcwd(),'convertedgisaid',fileNameStruct+str(fileCount)+".txt")
 f = open(f_in,'r')
 records = f.read()
 records = re.sub("_"," ",records)
 records = records.split('\n')
 records = records[1:]
 for rec in records:
  current = rec.split('|')
  fout.write(current[0]+" "+rec[-1:]+"\n")
 fileCount+=1

fout.close()

无法运行.py文件,但python中的所有代码都是vaild!还有一个原因,为什么python也没有识别我的标签?

抱歉,我是初学者:(

1 个答案:

答案 0 :(得分:0)

尝试使用http://www.cleancss.com/python-beautify/

重新格式化代码

您可以在此处详细了解如何设置代码格式:https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces