GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python Wiki
  • PSF Wiki
  • Jython Wiki
  • Python Wiki
  • Archive

This view

  • Original page
  • New address

GeezerVison is showing wiki.python.org — Using Enumerate

View as Markdown

Using Enumerate¶

Legacy Wiki Page

This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.

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.

Previous
Using DB API with Postgres
Next
Using Slots
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.