On 07/03/2016 23:09, Fillmore wrote:
I must be missing something simple because I can't find a way to break
out of a nested loop in Python.
Is there a way to label loops?
For the record, here's a Perl script of mine I'm trying to port...there
may be 'malformed' lines in a TSV file I'm parsing
On 3/7/2016 6:49 PM, Chris Angelico wrote:
On Tue, Mar 8, 2016 at 10:42 AM, Chris Kaynor wrote:
And the same rough example, using an exception without a function:
for file in files:
try:
for line in file:
section = line.split()
for section in line:
On 07/03/2016 23:09, Fillmore wrote:
I must be missing something simple because I can't find a way to break
out of a nested loop in Python.
Is there a way to label loops?
For the record, here's a Perl script of mine I'm trying to port...there
may be 'malformed' lines in a TSV file I'm parsing
On Mon, Mar 7, 2016 at 7:13 PM, Fillmore
wrote:
> On 3/7/2016 7:08 PM, Chris Angelico wrote:
>
>
>> Yep, which is why we're offering a variety of new paradigms. Because
>> it's ever so much easier to get your head around three than one!
>>
>> We are SO helpful, guys. So helpful. :)
>>
>
> not too
On 3/7/2016 7:08 PM, Chris Angelico wrote:
Yep, which is why we're offering a variety of new paradigms. Because
it's ever so much easier to get your head around three than one!
We are SO helpful, guys. So helpful. :)
not too dissimilarly from human languages, speaking a foreign language
is
On Tue, Mar 8, 2016 at 11:02 AM, Fillmore wrote:
> On 3/7/2016 6:09 PM, Fillmore wrote:
>>
>>
>> I must be missing something simple because I can't find a way to break
>> out of a nested loop in Python.
>
>
> Thanks to everyone who has tried to help so far. I suspect this may be a
> case where I j
On 3/7/2016 6:09 PM, Fillmore wrote:
I must be missing something simple because I can't find a way to break
out of a nested loop in Python.
Thanks to everyone who has tried to help so far. I suspect this may be a
case where I just need to get my head around a new paradigm
--
https://mail.
On Tue, Mar 8, 2016 at 10:42 AM, Chris Kaynor wrote:
> And the same rough example, using an exception without a function:
>
> for file in files:
> try:
> for line in file:
> section = line.split()
> for section in line:
> if sectionCorrupt:
>
On Tue, Mar 8, 2016 at 10:09 AM, Fillmore wrote:
> For the record, here's a Perl script of mine I'm trying to port...there may
> be 'malformed' lines in a TSV file I'm parsing that are better discarded
> than fixed.
>
> my $ctr = 0;
> OUTER:
> while($line = ) {
>
> $ctr++;
> if ($ctr < 5)
On 3/7/2016 6:29 PM, Rob Gaddi wrote:
You're used to Perl, you're used to exceptions being A Thing. This is
Python, and exceptions are just another means of flow control.
class MalformedLineError(Exception): pass
for line in file:
try:
for part in line.split('\t'):
On Mon, Mar 7, 2016 at 3:21 PM, Fillmore
wrote:
> On 3/7/2016 6:17 PM, Ian Kelly wrote:
>
>> On Mon, Mar 7, 2016 at 4:09 PM, Fillmore
>> wrote:
>>
>>>
>>> I must be missing something simple because I can't find a way to break
>>> out
>>> of a nested loop in Python.
>>>
>>> Is there a way to labe
Fillmore wrote:
>
> I must be missing something simple because I can't find a way to break
> out of a nested loop in Python.
>
> Is there a way to label loops?
>
> For the record, here's a Perl script of mine I'm trying to port...there
> may be 'malformed' lines in a TSV file I'm parsing that ar
On 3/7/2016 6:17 PM, Ian Kelly wrote:
On Mon, Mar 7, 2016 at 4:09 PM, Fillmore wrote:
I must be missing something simple because I can't find a way to break out
of a nested loop in Python.
Is there a way to label loops?
No, you can't break out of nested loops,
wow...this is a bit of a WTF
On Mon, Mar 7, 2016 at 4:09 PM, Fillmore wrote:
>
> I must be missing something simple because I can't find a way to break out
> of a nested loop in Python.
>
> Is there a way to label loops?
No, you can't break out of nested loops, apart from structuring your
code such that return does what you
I must be missing something simple because I can't find a way to break
out of a nested loop in Python.
Is there a way to label loops?
For the record, here's a Perl script of mine I'm trying to port...there
may be 'malformed' lines in a TSV file I'm parsing that are better
discarded than fix
On 2008-01-29, Jeremy Sanders <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>
>> Any elegant way of breaking out of the outer for loop than below, I
>> seem to have come across something, but it escapes me
>>
>> for i in outerLoop:
>>for j in innerLoop:
>>if condition:
>>
Jeremy Sanders wrote:
> [EMAIL PROTECTED] wrote:
>
>> Any elegant way of breaking out of the outer for loop than below, I
>> seem to have come across something, but it escapes me
>>
>> for i in outerLoop:
>>for j in innerLoop:
>>if condition:
>> break
>>else:
>>co
[EMAIL PROTECTED] schrieb:
> Any elegant way of breaking out of the outer for loop than below, I
> seem to have come across something, but it escapes me
>
> for i in outerLoop:
>for j in innerLoop:
>if condition:
> break
>else:
>continue
> break
It's working
[EMAIL PROTECTED] wrote:
> Any elegant way of breaking out of the outer for loop than below, I
> seem to have come across something, but it escapes me
>
> for i in outerLoop:
>for j in innerLoop:
>if condition:
> break
>else:
>continue
> break
Perhaps Python
On Jan 29, 8:55 pm, pataphor <[EMAIL PROTECTED]> wrote:
> On Tue, 29 Jan 2008 11:51:04 -0800 (PST)
>
> [EMAIL PROTECTED] wrote:
> > Any elegant way of breaking out of the outer for loop than below, I
> > seem to have come across something, but it escapes me
>
> > for i in outerLoop:
> > for j in
On Tue, 29 Jan 2008 11:51:04 -0800 (PST)
[EMAIL PROTECTED] wrote:
> Any elegant way of breaking out of the outer for loop than below, I
> seem to have come across something, but it escapes me
>
> for i in outerLoop:
>for j in innerLoop:
>if condition:
> break
>else:
>
[EMAIL PROTECTED] writes:
> Any elegant way of breaking out of the outer for loop than below, I
> seem to have come across something, but it escapes me
>
> for i in outerLoop:
>for j in innerLoop:
>if condition:
> break
>else:
>continue
> break
You can do it
Any elegant way of breaking out of the outer for loop than below, I
seem to have come across something, but it escapes me
for i in outerLoop:
for j in innerLoop:
if condition:
break
else:
continue
break
Thanks,
K
--
http://mail.python.org/mailman/listinfo/python
23 matches
Mail list logo