Skipping Parts of a For Loop

Andrew Henshaw andrew.henshaw at mail.com
Sun Sep 15 06:54:47 CEST 2002


Thomas Guettler wrote:

> Hi!
> 
> Is there a way to skip some parts in a for loop?
> 
> 
> for i in range(3):
> print "i before", i
> i=2
> print "i after", i
>
...snip... 
> 
> Is there a way to skip some parts?
> 
> "continue" skipps one element. But how can
> I skip several?
> 

While not really answering your question... In my opinion, it would be 
better to use a while loop for that purpose.  The code would be much 
clearer.

-- 
Andy Henshaw



More information about the Python-list mailing list