I'm wondering what line.split
does because I've been told it will help my code.
I'm trying to make a list consisting of the current data stored inside of an external text file.
My code goes as follows:
highscores = []
highscorefile = open('highscores.txt','r')
cont = highscorefile.readlines()
for line in cont:
highscores.append(line)
highscorefile.close()
print(highscores)
I've been told that line.split
will help sort it but I first need to figure out what it does.
Current output:
['1,3\n', '3,4\n', '6,5\n', '12,10']