我有一个包含以下数据的文件:
1,0.00008118
1,0.00008101
12,0.00008122
5,0.00008091
8,0.00008092
1,0.00008109
2,0.00008100
260,0.00008087
248,0.00007982
69,0.00007958
71,0.00007954
51,0.00007910
20,0.00007932
我希望能够对文件进行排序,以便将整数值从最低到最高排序。使用 sorted 函数进行排序时,它似乎是按数字排序。
a_s = sorted(List)
for i in a_s:
print(i)
所以输出是:
1,0.00008101
1,0.00008109
1,0.00008118
12,0.00008122
2,0.00008100
20,0.00007932
248,0.00007982
260,0.00008087
5,0.00008091
51,0.00007910
69,0.00007958
71,0.00007954
8,0.00008092
我将如何获得它以便将数值从最低值到最高值排序?
斯蒂芬大帝
相关分类