Human: Python: Filter lines from a text file which contain a particular word Assistant: 
Here is some code to filter lines from a text file 'textfile' which contain a word 'apple'

[line for line in open('textfile') if 'apple' in line]

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.