结题思路就是将DNA序列中的T换成U就可以啦,直接import re,然后用sub就行啦
import re rna_nucleotide = '' with open(r'D:Rosalindhaha.txt','w+') as f1: with open(r'D:Rosalind osalind_rna.txt','r') as f: for nucleotide in f: rna_nucleotide += re.sub('T','U',nucleotide) print (rna_nucleotide,file = f1)
或者在交互式界面中,import re,然后re.sub('T','U',seq),更方便些,但前提是序列要短,序列长的话内存吃不消啊