I'm trying iterate over lists in Python, but can't do it in an economic and pythonic way.
I can do in one dimension list:
api_time = ['hour', 'time']
text = 'What time is it?'
request = [r for r in api_time if r in text]
This outputs 'time'
, which is correct.
But when I start using two dimension list, I can't do it in one sentence.
api_time = ['hour', 'time']
api_weather = ['clime', 'rain']
apis = [api_time, api_weather]
How can I check this in one sentence?