main
pg7s85mrc 2 months ago
parent 526194612f
commit e7c9fd8aec

@ -0,0 +1,16 @@
#1.txt为关键词
#2.txt为提取目标
#3.txt储存提取结果
f = open('1.txt','r',encoding='utf-8')
q = open('3.txt','a+',encoding='utf-8')
line1 = f.readlines()
for l in line1:
p = open('2.txt', 'r', encoding='utf-8')
line2 = p.readlines()
for ll in line2:
if l.strip() in ll:
q.writelines(ll)
p.close()
f.close()
q.close()
Loading…
Cancel
Save