Sorting dict keys

zacherates zacherates at gmail.com
Sat Jul 21 10:36:58 EDT 2007


>From ESR's "Why python?"

b = a.keys(); b.sort()

Two statements, one line.  Doesn't create an incidental copy the way
sorted does but I'm not sure how much you like to jam on one line.

Cheers,
   Aaron




More information about the Python-list mailing list