A
Aaron Scott
I've been trying to read up on this, but I'm not sure what the
simplest way to do it is.
I have a list of string. I'd like to check to see if any of the
strings in that list matches another string.
Pseudocode:
if "two" in ["one", "two", "three", "four"]:
return True
Is there any built-in iteration that would do such a thing, or do I
have to write a function to check for me? I was using .index on the
list, but it would return True for strings that contained the search
string rather than match it exactly, leading to false positives in my
code.
simplest way to do it is.
I have a list of string. I'd like to check to see if any of the
strings in that list matches another string.
Pseudocode:
if "two" in ["one", "two", "three", "four"]:
return True
Is there any built-in iteration that would do such a thing, or do I
have to write a function to check for me? I was using .index on the
list, but it would return True for strings that contained the search
string rather than match it exactly, leading to false positives in my
code.