"Sean Novak" <[EMAIL PROTECTED]> wrote

I would normally write this in PHP like this:

for($i=1; i< count($someArray); $i++)
{
print $someArray[i]
}

essentially,, I want to loop through an array skipping "someArray[0]"

for i,n in enumerate(myArray):
    if i == 0: continue
    print n

is how I'd do it.

but in python the for syntax is more like foreach in PHP..

Indeed it is exactly like a foreach. I wish it were called foreach
except that its more typing. But it would save much confusion
among newbies!

 count = 0
 for i in range(1,10):
     if count == 0:
              count += 1
            continue
      else:
            print i

Should work


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to