I have two list:
main_list = [\'Smith\', \'Smith\', \'Roger\', \'Roger-Smith\', \'42\'] master_list = [\'Smith\', \'Roger\']
I want to coun
If your master_list is not expected to be huge, one way to do it is with regex:
import re def string_detection(master_list, main_list): count = 0 master = re.compile("|".join(master_list)) for entry in main_list: if master.search(entry): count += 1 return count