python if else contains string code example
Example 1: how to check a string in if statement python
if var == 'stringone' or var == 'stringtwo':
dosomething()
Example 2: check if string contains python
>>> str = "Messi is the best soccer player"
>>> "soccer" in str
True
>>> "football" in str
False