Here's the part that uses the file: 

```
file = open('Dice Game.txt', 'a')
file.write(winner + '\n')
file.close()
file = open('Dice Game.txt', 'r')
for line in file:
    name = line.strip()
    print(name)
file.close()

```

I know the part that prints the scores in quite bulky, but that seemed to be the only way I could get it to print correctly.

I've tried loads of different solutions I have found online, but none of them worked to sort the file numerically in descending order (and print the top 5 scores), they all seemed to give errors (when trying to use things such as `sort` and `sorted`).

The variable winner if defined as:

```
winner = str(score) + '=' + str(username)

```

I would like to figure out how I should change that variable or how I can sort it as it is.