In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > hi, > > I have the following list - > > ["1", "11", "2", "22"] > > how do I sort it like this - > > ["1", "2", "11", "22"] > > thanks, > > aine
Try: lst.sort(key = lambda s: int(s)) Assuming, of course, that "lst" is your original list; this will sort it in place. Also, you should probably read about the "sorted" function here: <http://docs.python.org/lib/built-in-funcs.html> Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA -- http://mail.python.org/mailman/listinfo/python-list