Pythonic list reordering

Tobiah toby at rcsreg.com
Fri Apr 9 12:19:58 EDT 2010


> How about a one liner?
> 
>     L.sort(key=lambda s: int(s.split('_')[1]))
> 
> (Which is not necessarily elegant, but it is short.)

I grant it a measure of elegance as well.




More information about the Python-list mailing list