im trying to create a leader board for a game im making. im trying to write the most recent high score to the top line of the text file above other lines, what should i do?
heres my code:
s = open("highscore.txt", 'r')
scores = s.read()
scores = int(scores)
if score > (scores):
highscore = score
print("NEW HIGH SCORE")
s = open("highscore.txt", 'a')
s.write(str(highscore))
s.write("\n")
s.close()
s = open("highscore.txt", 'r')
scores = s.read()
scores = int(scores)
s.close()