View Single Post
Old Sep 30th, 2007, 2:57 PM   #1
sixstringartist
Programmer
 
Join Date: Jun 2005
Posts: 68
Rep Power: 4 sixstringartist is on a distinguished road
Sorting integer lists

Im studying python and I am unsure of how to solve a problem.

Im taking user input of two strings consisting of integers. I split these on whitespace into two lists, merge the lists, and sort it. My problem is that these lists are being sorted by character and not integers (i.e. 22 > 3).

Ive searched for a solution to this but have yet to find one. Does Python know these are characters? Can I convert each value, element-by-element into integers and expect it to sort them numerically?

Thanks.
sixstringartist is offline   Reply With Quote