dictionary = {1:[2],2:[],5:[4,5],4:[5],3:[1]} temp=sorted(dictionary) sorted_dict = dict([(k,dictionary[k]) for i,k in enumerate(temp)]) sorted_dict: {1: [2], 2: [], 3: [1], 4: [5], 5: [4, 5]}