I am wondering if there is a way to do the following in a more compact style:
if (text == "Text1" or text=="Text2" or text=="Text3" or text=="Text4"): do_something()
The problem is that I have more than 4 comparisons in the if statement, and it starts to look pretty long, ambiguous, and ugly. Any ideas?
python comparison coding-style readability
Symon
source share