I have a python dictionary:
steps = {"5":{}, "1":{}}
I need to iterate this, but sorted by the keys as though they were ints. Key is always a number.
I tried:
def get_key_as_int(key):
return int(key)
for key in sorted(steps.items(), key=lambda t: get_key_as_int(t[0])):
step = steps[key]
but I get an error:
unhashable type: 'dict'