Here's my .txt file
-22, www 1213
-25, ttt 1234
-20, yyy 8883
I want to order the lines based on the first number.
I tried like this:
f = open('file_.txt','rb')
text = f.readlines()
sorted(text, key=lambda row: row[0], reverse=True)
but the order is the same. Using a variation for the sorted line
sorted(text, key=lambda row: float(row[0]), reverse=True)
I get the following error:
ValueError: could not convert string to float: -
What am I doing wrong?