for statement on empty iterable

Paul Rubin http
Wed Aug 22 01:46:02 EDT 2007


james_027 <cai.haibin at gmail.com> writes:
> Thanks for your quick answer ... Actually I was thinking how do I
> access the index inside a for statement? Can you help

It sounds like you're just starting to learn the language... have you
read the online tutorial yet?  That is a pretty easy introduction.

See: http://python.org/doc/

Anyway, you can say

   for i in (1,2,3):
      print i*5

to print 5, 10, and 15 on separate lines, for example.



More information about the Python-list mailing list