Python 2 dict_items.sort() in Python 3
Posted
by DaveWeber
on Stack Overflow
See other posts from Stack Overflow
or by DaveWeber
Published on 2010-03-15T02:13:45Z
Indexed on
2010/03/15
2:19 UTC
Read the original article
Hit count: 1024
python-3.x
|python
I'm porting some code from Python 2 to 3. This is valid code in Python 2 syntax:
def print_sorted_dictionary(dictionary):
items=dictionary.items()
items.sort()
In Python 3, the dict_items have no method 'sort' - how can I make a workaround for this in Python 3?
© Stack Overflow or respective owner