我需要通过一个巨大的(20GB,太大的内存)文本文件的生物序列数据库(GeneBank),并提取相同的信息为每个数据库条目。每个条目以LOCUS XYZ some more text
行开始,以//
行结束。例如:
LOCUS 123 some more text
many lines of some more text
many lines of some more text
many lines of some more text
//
LOCUS 231 some more text
many lines of some more text
many lines of some more text
many lines of some more text
//
LOCUS 312 some more text
many lines of some more text
many lines of some more text
many lines of some more text
//
现在,有没有一种方法可以告诉python迭代地将该文件中相应的3个块读取到某个变量var中。更准确地说:
迭代1:var=
LOCUS 123 some more text
many lines of some more text
many lines of some more text
many lines of some more text
//
迭代2:var=
LOCUS 231 some more text
many lines of some more text
many lines of some more text
many lines of some more text
//
迭代3:var=
LOCUS 312 some more text
many lines of some more text
many lines of some more text
many lines of some more text
//
预祝您节日愉快,万事如意
假设我们有以下文本文件:
我们可以做:
相关问题 更多 >
编程相关推荐