So I'm having a bit trouble here..
I'm kinda familiar with this the if x in xyz statement, I also got some good info from this link. So from the answer I understand what it does.. But I need it in reverse..
Like this: So I understand this concept:
text = "This whole sentence is text"
if text in ['whole', 'sentence']
do something
But i actually need to check if some of the words are in the sentence instead of the upper..
Can I just do it like this:
text = "This whole sentence is text"
if ['whole', 'sentence'] in text
do something
Or is there a better way to do this?
TL;DR
Keep in mind that the text
variable is coming from somewhere else and I can't really change it easily.
My google assistant is giving the text
variable back from what it heard, and I want to be able to have it do actions without having to say a full literal sentence, so normally it looks like this:
text = event.args['text'].lower()
if text == 'power off':
assistant.stop_conversation()
power_off_pi()
So it checks the whole sentence, I just want to be able to let it check for certain words in the sentence.
Thanks in advance!