I\'m writing a python program that takes a given sentence in plan English and extracts some commands from it. It\'s very simple right now, but I was getting some unexpected resu
"workspace" or "screen" or "desktop" or "switch"
is an expression, which always evaluate to "workspace"
.
Python's object has truth value. 0
, False
, []
and ''
are false, for example. the result of an or
expression is the first expression that evaluates to true. "workspace" is "true" in this sense: it is not the empty string.
you probably meant:
"workspace" in command or "screen" in command or "desktop" in command or "switch" in command
which is a verbose way to say what @Ashwini Chaudhary has used any
for.