Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Credits to Ctrl-S.
- # Given my_dict as a dict, where elements are either ints or lists of ints...
- # Convert to list of ints:
- to_sort = []
- for k in my_dict.keys():
- val = my_dict[k]
- if type(val) == int:
- to_sort.append(val)
- else:
- for subval in val:
- to_sort.append(subval)
- # Sort resulting list:
- # One of these will be sort of right
- results = sorted(to_sort)
- results = sort(to_sort)
- results = to_sort.sort()
- results = to_sort.sorted()
Add Comment
Please, Sign In to add comment