Sunday, October 15, 2006

Python iteritems function

The iteritems function returns an iterator over the key and value pairs in a Python dictionary

>>> wordz = {"school" : "schule", "weather" : "wetter"}

>>> for key, value in wordz.iteritems():
....... print key, "=", value


school = schule
weather = wetter

0 comments: