[Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

Sean Perry shaleh at speakeasy.net
Tue Mar 22 07:51:31 CET 2005


Tony Cappellini wrote:
> 
> 
> I have a program which currently passes 6 lists as arguments to zip(), 
> but this could easily change to a larger number of arguments.
> Would someone suggest a way to pass a variable number of lists to zip() ?
> 

well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply has 
been deprecated in 2.3.

So how about this?

arg_list = []
# fill up arg_list
zipped = zip(*arg_list)

?



More information about the Tutor mailing list