Posted By

dorseye on 08/19/09


Tagged

python index enumerate


Versions (?)

Index/Element #'s for list


 / Published in: Python
 

  1. >>> a = [2, 9, 17, 3]
  2. >>> for index, workwith in enumerate(a):
  3. ... print "element", index, "is", workwith
  4. ...
  5. element 0 is 2
  6. element 1 is 9
  7. element 2 is 17
  8. element 3 is 3
  9. >>>

Report this snippet  

You need to login to post a comment.