I have a text file, say:
cat 2
dog 4
bird 20
animal 3
I want to read this file and sort like this (according to numbers):
cat 2
animal 3
dog 4
bird 20
Code tried so far:
def txtsort(self, _, line):
words = []
for word in WORD_RE.findall(line):
words.append(word)
words_ini = words[0]
count_ini = np.array(words[1])
count_sort = np.sort(count_ini,axis = 0,kind='quikstart', order = None)