Skipping Parts of a For Loop

TeaAndBikkie teaandbikkie at
Sat Sep 14 16:44:31 EDT 2002

>> 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
An alternative to Alex's great suggestion, you could use an if statement:

for i in range(3):
    if 0<i<2: continue
    print i


More information about the Python-list mailing list