aine_canby wrote: > I have the following list - > > ["1", "11", "2", "22"] > > how do I sort it like this - > > ["1", "2", "11", "22"]
>>> items = ["1", "11", "2", "22"] >>> items.sort(key=int) >>> items ['1', '2', '11', '22'] This is more efficient than Amit's compare function and even Bruno's decorate-sort-undecorate (DSU) -- which of course only matters if the list becomes a bit larger. Peter -- http://mail.python.org/mailman/listinfo/python-list