I have a 2d list, in the first part I have a string which represents the measurement number while the 2nd part represents the corresponding numerical measurement. I have attached the list below, and python seems to have ordered it 1,10,11,...,2,3,4 etc.
My question is how do I get it in chronological order? So that PI_1.txt is followed by PI_2.txt and not PI_10.txt
['PI_1.txt', 1004.1]
['PI_10.txt', 1104.8]
['PI_11.txt', 1115.3]
['PI_12.txt', 1104.7]
['PI_2.txt', 1019.1]
['PI_3.txt', 1062.3]
['PI_4.txt', 1239.6]
['PI_5.txt', 1143.2]
['PI_6.txt', 1139.3]
['PI_7.txt', 1131.3]
['PI_8.txt', 1130.9]
['PI_9.txt', 1108.9]
The list is above to make my description a bit simpler.
Thank you!
p.s. I can't change the filenames so they are just integers, as part of my code uses a selection based on whether or not "PI" is included in the filename