First some background, i am writing a stats program for my school, the way you enter stats is by a window that has a textbox that shows how many of that stat the player has, lets say pass thrown, and two buttons a plus and a minus to add or subtract from that number. Now the way i am recording these stats is when the user clicks the plus button it opens up the stat file for the player and writes the stat name i.e. passes ans the number in the text box. My problem is when you go to write the stats information to the text file for the 20 plus stats they all get written on the first line each overwriting the one before it. So i need a way to write each stat on its own line.
Also as a side note this was the only way i could think to hold the stats information if there is a better way i would much like to know.
here is one of those definitions stated above:
begin = self.passes.GetValue() new = int(begin) + 1 self.passes.SetValue(str(new)) i = self.GetTitle() i.strip() file.close() file = open(i + '_stats.txt', 'a') file.writelines(str(new) + " passes" + "\n") file.close()