2009/11/28 Wayne Werner :
>
>
> On Sat, Nov 28, 2009 at 6:59 AM, Dave Angel wrote:
>>
>> And if the lists are large, use itertools.izip() which works the same,
>> but produces an iterator.
>>
>> Note that if the lists are not the same length, I think it stops when the
>> shorter one ends.
>
> But
On Sat, Nov 28, 2009 at 6:59 AM, Dave Angel wrote:
>
> And if the lists are large, use itertools.izip() which works the same, but
> produces an iterator.
>
> Note that if the lists are not the same length, I think it stops when the
> shorter one ends.
>
But you can use izip_longest:
import ite
Jose Amoreira wrote:
Hi!
I want to process corresponding elements of two lists, sequentially. Call the
lists list1 and list2, and assume they have equal lengths. I can do something
like
for index in range(len(list1)):
process(list1[index], list2[index])
But I find it somehow rather ugly,
On 11/28/2009 10:03 PM, Jose Amoreira wrote:
Yes, Robert, that does it! Thanks a lot!
Have a nice weekend!
Jose
don't forget zip() built-in function:
for x, y in zip(list1, list2):
print x, y
___
Tutor maillist - Tutor@python.org
To unsubscrib
Hi!
I want to process corresponding elements of two lists, sequentially. Call
the
lists list1 and list2, and assume they have equal lengths. I can do
something
like
for index in range(len(list1)):
process(list1[index], list2[index])
But I find it somehow rather ugly, because we generate yet
Yes, Robert, that does it! Thanks a lot!
Have a nice weekend!
Jose
On Saturday 28 November 2009 10:54:56 am Robert Johansson wrote:
> Hi!
> I want to process corresponding elements of two lists, sequentially. Call
> the
> lists list1 and list2, and assume they have equal lengths. I can do
> someth
Hi!
I want to process corresponding elements of two lists, sequentially. Call the
lists list1 and list2, and assume they have equal lengths. I can do something
like
for index in range(len(list1)):
process(list1[index], list2[index])
But I find it somehow rather ugly, because we generate yet