Ben Racine wrote:
I have a list...['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat', 'dir_330_error.dat'] I want to sort it based upon the numerical value only.Does someone have an elegant solution to this?Thanks, Ben R.
How about a one liner? L.sort(key=lambda s: int(s.split('_')[1])) (Which is not necessarily elegant, but it is short.) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list