python: lists comprehension to search strings inside list

 

 

myList = safeguarded_domains
searchTerm = domain

# Using list comprehension to find elements containing the searchTerm
matchingItems = [item for item in myList if searchTerm not in item]

print(matchingItems)

Leave a Reply

Your email address will not be published. Required fields are marked *