I have file containing data like:
12, 9
13, 9
45, 23
1, 4
0, 8
91, 45
638, 56
123, 3
2, 9
now what I need to do is sort it like:
0, 8
1, 4
2, 9
12, 9
13, 9
45, 23
91, 45
123, 3
638, 56
I have tried using:
import sys,csv
import operator
reader = csv.reader(open('filename.txt'),delimiter=',')
sort = sorted(reader,key=operator.itemgetter(0),reverse=False)
but this is not working for me. It arranging the column based on the 1st location not arranging as I wanted.i.e. :
0, 8
1, 4
12, 9
123, 3
13, 9
2, 9
45, 23
638, 56
91, 45
please help.