Running simultaneuos "FOR" loops

inshu chauhan insideshoes at gmail.com
Tue Apr 23 03:03:56 EDT 2013


zip isn't doing the required


On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan <insideshoes at gmail.com>wrote:

> Yes Simultaneously means all three running at the same time, I looked up
> zip just now, but will it not disturb my dictionaries ?
> And yes the dictionaries have same number of keys.
>
> thanks
>
>
> On Tue, Apr 23, 2013 at 12:16 PM, Chris Angelico <rosuav at gmail.com> wrote:
>
>> On Tue, Apr 23, 2013 at 4:40 PM, inshu chauhan <insideshoes at gmail.com>
>> wrote:
>> > i have to implement the below line in one of my code:
>> >
>> > for  p in sorted(segments.iterkeys()) and for k in
>> > sorted(class_count.iterkeys()) and for j in
>> sorted(pixel_count.iterkeys()):
>> >
>> > Its giving me a syntax error which is obvious, but how can I make all
>> three
>> > for loop run simultaneously or any other way to do this simultaneous
>> work
>> > ???
>>
>> Define simultaneously. Do the three dictionaries have the same number
>> of keys? If so, look up zip() or itertools.izip; if not, you may have
>> to more clearly define "simultaneous".
>>
>> ChrisA
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130423/490da8da/attachment.html>


More information about the Python-list mailing list