Differences between revisions 2 and 3
Revision 2 as of 2004-12-28 03:01:38
Size: 272
Editor: c-67-165-222-53
Comment:
Revision 3 as of 2008-11-15 13:59:44
Size: 272
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

enumerate is easy to use:

   1 for index, character in enumerate("hello"):
   2   print "#%d: %s" % (index, character)

...which prints out:

#0: h
#1: e
#2: l
#3: l
#4: o

You can use it on just about any iterable sequence.

UsingEnumerate (last edited 2008-11-15 13:59:44 by localhost)

Unable to edit the page? See the FrontPage for instructions.