premaseem.wordpress.com
Python: list comprehensions
# Python’s list comprehensions are awesome. vals = [expression for value in collection if condition] # This is equivalent to: vals = [] for value in collection: if condition: vals.append(expr…