I have a list:
foolist = ['123-asd', '234-asd', '345-asd']
I want to find the index of the string that contains '234'. At the moment I have this:
boollist = ['234' in i for i in foolist]
which would produce a list of True and Falses for each index for foolist.
Then to find the index, [print(i) for i,j in enumerate(foolist) if j==True]
This seems abit unecessary, does anyone have a more eloquent method of finding the index of a string in list based on a part of that string
[i for i,j in enumerate(foolist) if '234' in j]?