count in 'for ... in ...'

Achim Domma achim.domma at syynx.de
Tue Nov 6 11:05:32 EST 2001


"Uwe Schmitt" <uwe at rocksport.de> wrote in message
news:9s91c3$94mgs$1 at hades.rz.uni-sb.de...

> | for i in range(len(my_list)):
> |     print i,". ",my_list[i]

> What about the following ?
>
>    idx=0
>    for s in my_list:
>        print idx,".",s
>        idx+=1

two more lines ... not better, isn't it ?  ;-)

Achim






More information about the Python-list mailing list