Q:

keep data in the file python

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)

A:

Here is a demonstration of how file writing works, and the difference between w and a. The comments represent the text in the file that is written to the drive at each given point. 
f1 = open('appending.txt', 'w')
f1.write('first string\n')
f1.close()

# first string

f2 = open('appending.txt', 'a')
f2.write('second string\n')
f2.close()

# first string
# second string

f3 = open('appending.txt', 'w')
f3.write('third string\n')
f3.close()

# third string

