-2
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()

unable to run .py file however all the codes in python are vaild! And also is there a reason why python is not recognizing my tabs as well?

Sorry I'm a beginner here :(

TJA
  • 59
  • 1
  • 4

1 Answers1

0

Try to re-format your code for example using http://www.cleancss.com/python-beautify/

You can read more about how to format you code here: https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

zelenyjan
  • 663
  • 6
  • 7