newfile = open("Student Data.txt","w")
with open("Student Data.txt") as a_file:
data = a_file.readlines()
data[1] = username + " " + password + "\n"
with open("Student Data.txt", "w") as a_file:
a_file.writelines(data)
input()
i have created username and password with a input statement and and a int input for the age. If anyone can help me write this to a .txt file i would help me massively.