Created
February 10, 2015 09:48
-
-
Save miratcan/b382467fbbee84a02319 to your computer and use it in GitHub Desktop.
Find if a string present at list of strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def issubset(text, list_of_text): | |
""" | |
>>> msgs = ["abc", "def", "efg"] | |
>>> issubset("ab", msgs) # is subset of first item in msgs | |
True | |
>>> issubset("az", msgs) | |
False | |
>>> issubset("ef", msgs) | |
True | |
""" | |
return any([t in text for t in list_of_text]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment