search list of strings python code example
Example 1: find string in a list of strings
matching = [s for s in some_list if "abc" in s]
Example 2: python find string in list
list1 = ["a", "b", "c"]
isBInList = "b" in list1 # True
matching = [s for s in some_list if "abc" in s]
list1 = ["a", "b", "c"]
isBInList = "b" in list1 # True