I have a list:
data_list = ['a.1','b.2','c.3']
And I want to retrieve only strings that start with strings from another list:
test_list = ['a.','c.']
a.1 and c.3 should be returned.
I suppose I could use a double for-loop:
for data in data_list:
for test in test_list:
if data.startswith(test):
# do something with item
I was wondering if there was something more elegant and perhaps more peformant.