On 13/07/2020 18:42, Barry Scott wrote:
On 13 Jul 2020, at 05:55, Christopher Barker <firstname.lastname@example.org mailto:email@example.com> wrote:
well, sure, though I have to say that I think that that's an unfortunate confusing thing about python dicts. IN fact, I doubt there are many uses at all for dict.keys() -- most uses can jsut use the dict.
I use key() all the time to sort the keys before printing.
for name in sorted(dict.key()): print(name, dict[name)
But you could use items() instead: for name, val in sorted(dict.items()): print(name, val)