Hi,
I am new to python, and i am trying to make a program that makes like a txt
file database. so i have my whole program in a while True loop, it asks for
information about the person and then writes the information about the person
to a txt file, but i need it to be able to add more entries instead of just one.
my code is like this:
while True:
name = raw_input("what is the name ")
age = raw_input("what is the age ")
out_file = open("persons.txt", "w")
out_file.write("name: ")
out_file.write(name)
out_file.write("\n")
out_file.write("age: ")
out_file.write(age)
out_file.write("\n")
out_file.write("\n")
out_file.close
now i want to add like say 5 persons to the txt file, but whenever i enter a
new person it just overwrites the previous, im sure its because of the "w" but
how exactly do i need to change my code to add more text instead of overwriting?
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor