if string is not in array python code example
Example 1: if string is in array python
if item in my_list:
# whatever
Example 2: python not in list
>>> 3 not in [2, 3, 4]
False
>>> 3 not in [4, 5, 6]
True
if item in my_list:
# whatever
>>> 3 not in [2, 3, 4]
False
>>> 3 not in [4, 5, 6]
True