>gene1
ATGATGATGGCG
>gene2
GGCATATC
CGGATACC
>gene3
TAGCTAGCCCGC
这是我正在读的文本文件。 我想读取不同字符串中的每个基因,然后将其添加到列表中 有以“>;”字符开头的标题行可以识别这是一个基因的开始还是结束
with open('sequences1.txt') as input_data:
for line in input_data:
while line != ">":
list.append(line)
print(list)
打印时,列表应显示
list =["ATGATGATGGCG","GGCATATCCGGATACC","TAGCTAGCCCGC"]
您的代码中有多个错误,请看这里:
试试这个:
输出:
相关问题 更多 >
编程相关推荐