I'm working in Python, using any() like so to look for a match between a String[]
array and a comment pulled from Reddit's API.
Currently, I'm doing it like this:
isMatch = any(string in comment.body for string in myStringArray)
But it would also be useful to not just know if isMatch
is true, but which element of myStringArray
it was that had a match. Is there a way to do this with my current approach, or do I have to find a different way to search for a match?