Building loop with some exceptions?

alex23 wuwei23 at gmail.com
Tue Nov 4 18:55:06 EST 2008


On Nov 5, 5:20 am, Gilles Ganault <nos... at nospam.com> wrote:
> 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:

  exclusions = [04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89]
  for i in (x for x in xrange(1,100) if x not in exclusions):
      ....




More information about the Python-list mailing list