最简单粗暴的逐行检查
import os
fileA = 'a.txt'
fileB = 'b.txt'
with open(fileA, 'r') as fpa:
for lineA in fpa:
with open(fileB, 'r') as fpb:
for lineB in fpb:
if lineA.replace('\n', '').find(lineB.replace('\n', '')) >= 0:
print(lineB.replace('\n', '') + ' in ' + lineA.replace('\n', ''))