I am checking whether two substrings are contained in another string:
if (substr1 and substr2) in str:
my_func()
This does not work, the if statement is already being entered when only one substring is part of the string. Can someone explain why?
I found the following workaround, I'd simply like to know why Python behaves that way.
substr_list = [substr1, substr2]
if all(substr in str for substr in substr_list):
my_func()