with open('source.txt', 'rb') as f:
    with open('new.txt', 'wb') as g:
        g.writelines(filter(lambda line: 'apple' in line, f))
Python: Filter lines from a text file which contain a particular word