I have a piece of code and I would like to transfer everything the user types to a different file so that I can keep that information forever. How would I do this? My code is below. Please note that my code is completely in python 3.6.1.
username = input('What is your name: ')
with open (username, "w") as u:
u.write(input())
username = input('What is your name: ')
u=open(username+".txt", "w")
while True:
print("enter your inputs")
inp=input()
u.write(inp+"\n")
#do something with inputs.
if(inp=="exit"):
break
u.close()