Created
July 13, 2012 23:20
-
-
Save Nurdok/3108181 to your computer and use it in GitHub Desktop.
Double Iteration in List Comprehension
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
>>> seq = ['abc', 'def', 'g', 'hi'] | |
... [y for x in seq if len(seq) > 1 for y in x if y != 'e'] | |
['a', 'b', 'c', 'd', 'f', 'g', 'h', 'i'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment