Masklinn kirjoitti: > On 28 May 2009, at 15:30 , Alex Gaynor wrote: >> On Thu, May 28, 2009 at 8:11 AM, Masklinn <[email protected]> >> wrote: >> >>> On 28 mai 09, at 14:55, Jani Tiainen <[email protected]> wrote: >>>> laspal kirjoitti: >>>>> Hi, >>>>> I have 2 list and want to iterate as one in template. >>>>> How can I do it. >>>>> example-> >>>>> list1 = [10,20,30,30] >>>>> list2 = [aa,bb,cc,dd] >>>> combinedlist = ( (a[x],b[x]) for x in range(len(a)) ) >>>>> >>> Reinventing zip (or, in this precise case, itertools.izip) might not >>> be as simple as just using them though. >>> >> I don't think he's looking for zip, it sounds like he wants >> itertools.chain, >> >> from itertools import chain >>>>> chain([1,2,3], [3,2,1]) >> [1,2,3,3,2,1] > From his initial example, it looks like zip more than chain, but in > any case I was responding to Jani whose answer is a reimplementation > of izip ;)
True.... :) I'm very good at reinventing wheels... :) (Well, it's just my very rusty Python skills tbh.). But yes, original seemed to be izip (or izip_longest) whichever may fit. -- Jani Tiainen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

