I have a list
myList = ["what is your name", "Hi, how are you","What about you", "How about a coffee", "How are you"]
Now I want to search index of all occurrence of "How"
and "what"
. How can I do this in Pythonic way?
I have a list
myList = ["what is your name", "Hi, how are you","What about you", "How about a coffee", "How are you"]
Now I want to search index of all occurrence of "How"
and "what"
. How can I do this in Pythonic way?
Sounds like a one-liner Python is able to do!
[i for i, j in enumerate(myList) if 'how' in j.lower() or 'what' in j.lower()]