I am trying to sort by key, but it's not working because I don't think that the thing that I'm trying to sort on counts as a list (in fact I think it is an ndarray?):
y = np.genfromtxt("1400list.txt", dtype=[('filename','S20'),('freq','S20')])
gives me y as something in the form:
[('a070918_215953.SFTC', '1369.000') ('a070918_220602.SFTC', '1369.000')
('a070918_221210.SFTC', '1369.000') ('r080323_044006.SFTC', '1369.000')
which is fine - but I want to sort by the first number, and not by the first letter which it is doing at the moment. Can anyone help please?
EDIT: Sorry I should have said that I tried:
y.sort(key=lambda y: y)
But I got the error:
TypeError: 'key' is an invalid keyword argument for this function
Thank you in advance.