【发布时间】:2018-04-06 00:41:10
【问题描述】:
我是 BioPython 的新手,我正在尝试导入一个 fasta/fastq 文件并遍历每个序列,同时对每个序列执行一些操作。我知道这看起来很基本,但是由于某种原因我的下面的代码打印不正确。
from Bio import SeqIO
newfile = open("new.txt", "w")
records = list(SeqIO.parse("rosalind_gc.txt", "fasta"))
i = 0
dna = records[i]
while i <= len(records):
print (dna.name)
i = i + 1
我试图基本上遍历记录并打印名称,但是我的代码最终只打印“records[0]”,我希望它打印“records[1-10]”。有人可以解释为什么它最终只打印“records[0]”吗?
【问题讨论】: