s='I like elephants.\nThey are nice'res = [line for line in s.split('\n') if 'elephants' in line]print(res)
Standard input is empty
['I like elephants.']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!