[Tutor] List comprehensions

Alan Gauld alan.gauld at freenet.co.uk
Wed Mar 23 21:24:32 CET 2005


> Is there a way to apply multiple actions within one list
comprehension?

Write a function?

def foo(i):
   # do stuff to i
   return i

[foo(i) for i in alist]

Alan G.



More information about the Tutor mailing list