I have a list of strings called my_strings
. I want to pull out all strings within that list that contain search_string
My attempt is the following:
new_strings = [my_str for my_str in my_strings if search_string in my_str]
I am getting the following error
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
But I don't understand why because I am just comparing two strings. If I manually pull out a random element in my terminal and do the comparison myself it works fine.