How can I obtain a list of key-value tuples from a dict in Python?
For Python 2.x only (thanks Alex):
yourdict = {}
# ...
items = yourdict.items()
See http://docs.python.org/library/stdtypes.html#dict.items for details.
For Python 3.x only (taken from Alex's answer):
yourdict = {}
# ...
items = list(yourdict.items())