On Tue, Jun 10, 2008 at 09:36:47PM -0400, Sean Novak wrote:
> I know I'm going to feel stupid on this one..
>
> 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]"
>
> but in python the for syntax is more like foreach in PHP..
>
> I've tried this to no avail
>
>  count = 0
>  for i in range(1,10):
>        if count == 0:
>               continue
>       else:
>               count += 1
>               print i
>               continue
>
> it prints absolutely nothing.

The count var is never updated. What about:

for i in someArray[1:]:
    print i


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

Reply via email to