Last active
August 29, 2015 14:07
-
-
Save reox/d160d1ce8f5a739315b1 to your computer and use it in GitHub Desktop.
Check if string starts with multiple substrings
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
words = ["foo", "bar", "blafoo"] | |
check_list = lambda x, y: map(lambda z: not x.startswith(z), y) | |
if not all(check_list("foobarfoo", words)): | |
print("String starts with one of the substrings") | |
else: | |
print("String does not start with one of the substrings") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment