1keyword_list = ['motorcycle', 'bike', 'cycle', 'dirtbike']
2
3if any(word in all_text for word in keyword_list):
4 print 'found one of em'
1ls = ['Hello from AskPython', 'Hello', 'Hello boy!', 'Hi']
2
3matches = [match for match in ls if "Hello" in match]
4
5print(matches)
6
1ls = ['Hello from AskPython', 'Hello', 'Hello boy!', 'Hi']
2
3# The second parameter is the input iterable
4# The filter() applies the lambda to the iterable
5# and only returns all matches where the lambda evaluates
6# to true
7filter_object = filter(lambda a: 'AskPython' in a, ls)
8
9# Convert the filter object to list
10print(list(filter_object))
11