python if string not in list then code example
Example 1: if string is in array python
if item in my_list:
# whatever
Example 2: check if list contains string python
some_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456']
if any("abc" in s for s in some_list):
# whatever