In list of dictionaries I would like to find key value containg string.
markets = [ {'symbol': 'BTC/AUD', 'baseId': 'bitcoin'}, {'symbol': 'USD/AUD', 'baseId': 'dollar'}, {'symbol': 'EUR/AUD', 'baseId': 'euro'}, {'symbol': 'ETH/BTC', 'baseId': 'eth'}, ] s = 'BTC' I would like to find in symbol values dicts containing a string. For example: Searching for s in markets symbols should return folowing list of dicts:
found = [ {'symbol': 'BTC/AUD', 'baseId': 'bitcoin'}, {'symbol': 'ETH/BTC', 'baseId': 'eth'}, ] Any help you can give would be greatly appreciated.