for loop counting backward?

Eric Wichterich eric.wichterich at gmx.de
Sun Oct 12 12:57:32 EDT 2003


Hello,

I am converting a perl-script to python and have problems with this 
simple perl-statement:

for ( $i = 100; $i > 2; $i-- ) {do something }

Does anyone know how to write this in python? I did not find any 
documentation about counting backward in a for loop...

By the way:
I converted following perl - statement:

for $i ( 2 .. 100 ) { do something}

into python:

for counter in range(2,100)
	do something

Thank you very much,
Eric






More information about the Python-list mailing list