Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
python_wiki:list_comprehensions [2018/08/03 00:55] billdozor [The Code] |
python_wiki:list_comprehensions [2018/08/03 00:58] billdozor [The Code] |
||
---|---|---|---|
Line 30: | Line 30: | ||
====== The Code ====== | ====== The Code ====== | ||
+ | **List Comprehension Syntax** | ||
+ | <code python> | ||
+ | new_list = [x for x in iterable if filter] | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | **List Comprehension Example** | ||
<code python list-comp.py> | <code python list-comp.py> | ||
# | # |