The answer to this question is down in the comments. So for school I've written this program which asks for information about what a person will bring to a LAN-party. This will happen in a loop, so it will ask for every participant until the participant number has reached 256. I've added some code so some lines will be written to a textfile. My problem is, with every participant, so everytime the loop starts from the beginning, the textfile will be replaced. I can't seem to find where to look for the solution. Here's some lines from my code:
uid=0
while uid <= 256:
fo = open('userID.txt','w')
print("\nUserID: ",uid)
fo.write("\nUserID: " + str(uid))
fo.close()
input("")
Now, my textfile will show the uid(user id), that was displayed when I closed the program. So 1 or 5 or 200, but what I want is that it shows everything until I close the program: 0 1 2 3 4 and so on... Enhancing instead of replacing, so to speak.
The writing to a textfile aspect is something I did for fun. I have already handed in the program, but still want to solve my problem. I am a starting programmer, this is the first block of programming I've had.