Created
March 26, 2012 10:46
-
-
Save ogra/2204403 to your computer and use it in GitHub Desktop.
returns if any elements in example_list are in example_string.
This file contains 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
# the following code returns if any elements in example_list are in example_string. | |
True in [x in example_string for x in example_list] | |
# example: 'a' is in 'apple', so True is returned. | |
# >>> example_list = ['a', 'b', 'c'] | |
# >>> example_string = 'apple' | |
# >>> True in [x in example_string for x in example_list] | |
# True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment