sorting dictionary keys?

Jay O'Connor joconnor at cybermesa.com
Sat Nov 29 16:46:10 EST 2003


John Smith wrote:

 > Hi, what's the fastest way (least amount of typing)

Never good criteria

>but I would like to do:
>#error here
>for k in d.keys().sort():
>    print k, d[k]
>
>why doesn't the nested function call work?  Thanks in advance.
>

sort() sorts in place and returns None





More information about the Python-list mailing list