I'm quite new to python and have a question regarding list matching. What would be the most efficient method of searching for matching items in a list?
Ideally, the code would look like:
list1 = ['spam', 'eggs', 'bacon'] list2 = ['spam', 'ham', 'king richard'] matchitems(list1, list2) ... "There is/are X matching item(s)" (in this case 1)
Am I right in thinking the best way to approach this would be with regular expressions? Perhaps a raw string search which adds to a counter every time an item is found in both lists?
I will be dealing with lots of large lists (music tags) so would like to work on an efficient method for this.
Any advice much appreciated (and if I've missed anything obvious, then apologies, I have looked through the documentation but there isn't much regarding this problem apart from using regexes).