I have Python list like this:
['assistant manager', 'salesperson', 'doctor', 'production manager', 'sales manager', 'schoolteacher', 'mathematics teacher']
Now I want to search with multiple keywords in my list, e.g:
When I try to input the keyword teacher and sales
input keywords: teacher sales
it should return result like this:
- schoolteacher
- mathematics teacher
- salesperson
- sales manager
So far I have made a code like this:
job_list = ['assistant manager', 'salesperson', 'doctor', 'production manager', 'sales manager', 'schoolteacher', 'mathematics teacher']
def search_multiple_words(search_words):
search_words = [search_words]
for line in job_list:
if any(word in line for word in search_words):
print(line)
search_words = input("input keywords: ")
search_multiple_words(search_words)
But it just works when I input one keyword, not multiple keywords like example I gave above.
So, how to do that..?