withopen('YLG.sort.fasta','r') as pep: for line in pep: if line.startswith('>'): name = line.strip().split()[0] res_dict[name] = '' else: res_dict[name] += line.replace('\n','')
gen = '' for cds_id, sequence in res_dict.items(): #print(sequence) gen = gen + sequence
withopen('genome.txt', 'a') as file: file.write(gen)