实现并行查找关键字所在的行?
经常遇到提取问题,一旦要提取的文件很大,关键字很多,可以使用集合#!/usr/bin/env python# -*- coding: utf-8 -*-__author__ = 'Shengwei Ma'__author_email__ = 'shengweima@icloud.com'with open('3.txt', 'r') as f1:a = set(lin...
·
经常遇到提取问题,一旦要提取的文件很大,关键字很多,可以使用集合
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Shengwei Ma'
__author_email__ = 'shengweima@icloud.com'
with open('3.txt', 'r') as f1:
a = set(line.strip() for line in f1)
with open('wheat_est_gi.fa.gff3', 'r') as f:
for line in f:
line1 = line.strip().split('\t')
Name = line1[8].split(';')[1].split('=')[1]
if Name in a:
print line,
更多推荐



所有评论(0)