-
-
Save kinghat/19d85223657d4d26790ed2946e4faf7f to your computer and use it in GitHub Desktop.
Explaining 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
new_list = [do_something_with(x) for x in old_list] | |
# is basically short for | |
new_list = [] | |
for x in old_list: | |
new_list.append(do_something_with(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment