Sorting dict keys

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Jul 21 02:31:17 CEST 2007


On Fri, 20 Jul 2007 15:27:51 -0700, montyphyton wrote:

>>>> b = a.keys()
>>>> b.sort()
> [1, 2, 3]
> 
> Works fine, but I would really like it if I could somehow do it in one
> line. 

Why? Is the Enter key on your keyboard broken? Is there a global shortage
of newline characters that I haven't been told about? Does your employer
pay you less if you write more lines?



-- 
Steven.




More information about the Python-list mailing list