with open('/usr/share/dict/words') as words:
    prefixes = [line.strip() for line in words]
lines = ['zoo this should match', "000 this shouldn't match"]
print(list(filterlines(prefixes, lines)))
Fastest check if line starts with value in list?