[2.5.1] Building loop with some exceptions?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Tue Nov 4 17:34:49 EST 2008


On Tue, 04 Nov 2008 20:20:20 +0100, Gilles Ganault wrote:

> Hello
> 
> I need to call a URL through a loop that starts at 01 and ends at 99,
> but some of the steps must be ignored:
...
> I'm clueless at what the Python way is to do this :-/

Perhaps you should start by doing the Python tutorial, so you'll be less 
clueless of simple things like how to do a loop.

http://docs.python.org/tutorial/



for i in range(1, 100):
    if i in (4, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89):
        continue
    do_rest_of_processing


-- 
Steven



More information about the Python-list mailing list