Python Lambdas and List ComprehensionTempo de Leitura: 1 min

A way to create new lists in python using list comprehension.

new_list = [apply(i) for i in old_list if filter(i)]

Using Lambdas

You can also use lambda functions to manipulate old lists into new ones.

new_list = map(lambda v : v * 5, old_list)

Leave a Reply

Your email address will not be published. Required fields are marked *