> I want to display a dict sorted by value. > > This is my dict: > > total={} --------another code-snip--- def swap(el): return (el[1],el[0]); total = {} list = map(swap,total.items()); list.sort(); ------ or shorter ------ total = {} list = map(lambda el : (el[1],el[0]) ,total.items()); list.sort();