with open("a.txt") as master_file: keywords = {line.strip() for line in master_file} # this is a set comprehension # https://docs.python.org/3/library/stdtypes.html#types-set # https://docs.python.org/3/tutorial/datastructures.html#sets # this gives you an unique set of the lines in master_file # line.strip() removes newlines and whitespace # all happens inside memory, if the file is bigger than your memory, this doesn't work # here you can work with keywords. # just iterate over the second file, split the line, select the right field and look if this field # is in keyweords, if True, then do something with the information # like writing it to a third file
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!