vimwiki

Python list comprehension

Create a new list from another one.

newlist = [expression for item in iterable if condition == True]

myList = [2, 3, 5, 1]
myNewList = [x * 2 for x in myList if x > 2]