I'm having a hard time trying to figure out the best way to do a search on 2 lists. I've explored many post here that suggest using things like any()
or all()
or regex... I do have it functioning now, but I use this type of search a lot and I really would like to be doing this right.
SearchList = ['blah-1.2.3.tar.gz', 'blah-1.2.4.tar.gz', 'blah-1.2.5.tar.gz']
BaseList = ['blah-1.2.3', 'blah-1.2.4']
I would like to search the BaseList for the '1.2.3'
, '1.2.4'
, and '1.2.5'
in the items of SearchList
. I have been using a for
loop within a for
thing but I would like something cleaner that would use pythons list comprehension/generator expression, and any()
or some other regex type solution.