On Aug 14, 11:27 am, [EMAIL PROTECTED] (Lawrence Oluyede) wrote: > Bryan <[EMAIL PROTECTED]> wrote: > > How do I do this? > > for i, item in enumerate(l): > print i, item >
^^ That is the `most-correct` answer. But because you're new, I'll take this time to introduce you to help(), just in case you're too lazy to RTFM (like me ;)). help works on objects, and things you may not expect - try help(2). Oh and welcome to `fun` programming! >>> help(enumerate) class enumerate(object) | enumerate(iterable) -> iterator for index, value of iterable | | Return an enumerate object. iterable must be an other object that supports | iteration. The enumerate object yields pairs containing a count (from | zero) and a value yielded by the iterable argument. enumerate is useful | for obtaining an indexed list: (0, seq[0]), (1, seq[1]), (2, seq[2]), ... .. and a bunch of stuff I clipped ... hth, jw -- http://mail.python.org/mailman/listinfo/python-list