I have this list:
item = ['AAA:60', 'BBB:10', 'CCC:65', 'DDD:70', 'EEE:70']
and then I get this string passed to me:
widget = 'BBB'
I'd like to find the entry in item
based on widget
.
I want to find the entry in the list if widget
is contained in any of the list entries. Something where I can use item[i]
and preserve the list for the loop it will endure.
Final output would be the list entry itself, BBB:10
. (In the example provided.)