Tuple list from dict in Python [duplicate]
This question already has an answer here: How can I convert a dictionary into a list of tuples? 10 answers How can I obtain a list of key-value tuples from a dict in Python? Andrew Keeton 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()) For a list of of tuples: my_dict.items() If all you're doing is iterating over the items, however, it is often preferable to use dict.iteritems() , which is