I have two lists that are not exact matches but do not content that almost match and I want to compare them and get out a list of one that match and do not match:
name = ['group', 'sound', 'bark', 'dentla', 'test']
compare = ['notification[bark]', 'notification[dentla]',
'notification[group]', 'notification[fusion]']
Name Compare
Group YES
Sound NO
Bark YES
Dentla YES
test NO
You can use comprehensions for making compare list usable; and you can check items in name with
item in clean_compare:If you want to print it:
Edit:
Or if you want just to print them, you can do it easily with a for loop: