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

Shidai Liu shidai.liu at gmail.com
Tue Mar 22 11:04:51 CET 2005


On Mon, 21 Mar 2005 22:51:31 -0800, Sean Perry <shaleh at speakeasy.net> wrote:
> Tony Cappellini wrote:
> 
> 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)
> 

I met a similar question.
what if one has L = [[1,2],[3,4]], K = [100, 200]
How to 'zip' a List like [[1,2,100], [3,4,200]]?

-- 
With best wishes!
Shidai


More information about the Tutor mailing list