Is it possible to seek more than 1 text in a text file using the seek method?
Hello, what am try to do is create this high score system for my game. Initially, all it does is to store an integer (converted to string first) in a text file. If the current score is greater than the high score that it saved from previous game plays, it will clear that score and write the current score as the high score. But the issue is, it's only comparing the first integers in the scores, for eg. say that the current high score is now 70 and i play the game and got a score of 110. It will not save 110 because its comparing the 1 to the 7 only and not the entire integer. How can I fix this? This is my code: stop = 0 def HighScore(): global stop if stop<1: with open('HighScore.txt','r+') as hs: for score in hs: if for_cfile > score: hs.seek(0) hs.truncate() hs.write(for_cfile) print('New HighScore!\n',for_cfile,'\nCongratulations!') print("\nGame Over") stop += 1