Need help cant write to file alphabetically
class_name = "class 1.txt" #adds '.txt' to the end of the file so it can be used to create a file under the name a user specifies
with open(class_name , 'r+') as file:
name = (name)
file.write(str(name + " : " )) #writes the information to the file
file.write(str(score))
file.write('\n')
lineList = file.readlines()
for line in sorted(lineList):
print(line.rstrip())