Python 2 Dict_items.sort() In Python 3
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 Pyth
Solution 1:
Use items = sorted(dictionary.items())
, it works great in both Python 2 and Python 3.
Post a Comment for "Python 2 Dict_items.sort() In Python 3"