Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44402
| References | <CAFqGZRF4s_+9R4qDZTmFD7OWWMTn_YnhjKNMh8gY97ng5tyr9g@mail.gmail.com> <kldg7b$20b$1@ger.gmane.org> <CAFqGZRGoh=hTG7PZgxNaaKgq8Z_QHyqVQZ+voe1z_KY+-ysjug@mail.gmail.com> |
|---|---|
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
| Date | 2013-04-26 10:44 +0100 |
| Subject | Re: Nested For loop not running full |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1091.1366969475.3114.python-list@python.org> (permalink) |
On 26 April 2013 10:36, inshu chauhan <insideshoes@gmail.com> wrote: > > On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten <__peter__@web.de> wrote: >> >> My crystal ball says that the 'for sy...' and 'for sx...' loops are >> running >> to completion, but you don't get the coordinates printed because you put >> them into the 'for l in f' loop which will only run once. > > Is there any means by which I can run this 'For l in f' loop again and again > ? >> >> The quick and dirty fix is to replace >> >> f = open(...) >> >> in the code you are not showing with >> >> f == list(open(...)) > > f is just a text file(csv format).. so why list ?? So that you can run the for l in f loop again and again. You can loop over a list as many times as you like but only once over a file (unless you reset the file pointer). Oscar
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Nested For loop not running full Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-26 10:44 +0100
csiph-web