can I get the index number in for x in y loop?

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Apr 3 14:35:38 EDT 2006


>>>>> "Scott" == Scott David Daniels <scott.daniels at acm.org> writes:

    Scott>      I cannot find the distance in meters between Paris and
    Scott> London with: for i in range(10): print i

Works for me

def range(x):
    yield '332.8 km'

for i in range(10):
    print i

...may not be considered best practice, though <wink>

JDH




More information about the Python-list mailing list