Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44150
| References | <CAFqGZRGmNj1Hsedz0j8aHw+0UN+a+RDOFNUd1fU2v22T5VyhGg@mail.gmail.com> |
|---|---|
| Date | 2013-04-23 16:46 +1000 |
| Subject | Re: Running simultaneuos "FOR" loops |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.955.1366699597.3114.python-list@python.org> (permalink) |
On Tue, Apr 23, 2013 at 4:40 PM, inshu chauhan <insideshoes@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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Running simultaneuos "FOR" loops Chris Angelico <rosuav@gmail.com> - 2013-04-23 16:46 +1000
csiph-web