category
5/7/2017 - 2:48 PM

Substring List Intersection

Substring List Intersection

Substring List Intersection

In [12]:  substrings = ['0012', '0013', '0007']
 strings = ['a0012', 'a0013', 'a0014', 'a0011', 'a006']


 [ e for e in substrings if reduce(lambda b1, b2: b1 or b2, list(map(lambda item: e in item, strings)))]

Out[14]: ['0012', '0013']