hi guys how are you I hope that well, I'm new using python and I'm doing a program but I dont know how to save the data permanently in a file. I only know how to create the file but i dont know how can i keep the data on the file eventhough the program be closed and when i open it back i be able to add more data and keep it in the file too.I have also tried several methods to upload the file on python but they didnt work for me. Can someone please help me? This is my code:
file = open ('file.txt','w')
t = input ('name :')
p= input ('last name: ')
c = input ('nickname: ')
file.write('name :')
file.write(t)
file.write(' ')
file.write('last name: ')
file.write(p)
file.write('nickname: ')
file.write(c)
file.close()
with open('archivo.txt','w') as file:
data = load(file)
print(data)