Sorting dict by value w/ operator.itemgetter- using key name?

Wells Oliver wells at
Thu Jul 30 20:45:53 CEST 2009

Bit of code:

print sorted(results.items(), key=operator.itemgetter(1))

Would rather use 'H9', which is the name of the key in position 1 like:

print sorted(results.items(), key=operator.itemgetter('H9'))

Obviously that ain't work else I wouldn't be sending this email. Any tips?

Wells Oliver
wells at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list