[Tutor] Help with file editing

tanner barnes tanner989 at hotmail.com
Thu Jun 11 19:08:09 CEST 2009

Ok, so i am creating a program for my school's football team and in one part i need to store a list of variables (their name, height, weight, and grade) in a txt file to bring up later. i know how to create and read from files ( file = open("file_name", ''w/r/a") ). But what i need to do is create a individual file for each member on the roster as they add them in. here is my code:

name = self.name.GetValue() < gets their name from the text box
        stats = str(self.name.GetValue()) + "\n"      < gets their name to put into the file
        stats += str(self.height.GetValue()) + "\n"   < gets their height
        stats += str(self.weight.GetValue()) + "\n"  < gets their weight
        stats += str(self.grade.GetValue()) + "\n"    < gets their grade
        info = open(name + ".txt", "r") < this creates the file for it to all go into using the name we get from above to name it.

But when a try and write into the file wright after that last line it wont let me so is there anything i'am missing or should change?

Windows Live™: Keep your life in sync. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090611/5caf5423/attachment.htm>

More information about the Tutor mailing list