Okay, so I have a bit of a problem, Im new to python sorry.
I am trying to sort a list by score, which is a number, but if there is a draw I need to sort them by the
You'd have to iterate over each line and use the sort
method on them
#open the file and read through the lines.
lines = open('yourfile.txt').readlines()
#iterate over each line, and split along the spaces
pairs =[]
for line in lines:
split_string = line.split('')
num = int(split_string[0])
pairs.append((num, split_string[1:])
#sort through the pairs (from mgilsons answer)
pairs.sort(key=lambda x: (x[0],len(x[1]))
edit: actually misread the question.