I'm pretty new to programming, so this may be really obvious, but I'm having trouble with it. I'm trying to learn python, so I thought I'd make a simple program in python to help me write similar lines of java code faster, (I'm going to easily have hundreds of lines of this.) and I've got it all worked out, except one little thing, which I'm sure is very simple, but I searched around a bit for it, and couldn't find anything, so I thought I'd just ask here before going to bed.
As you can probably tell, this will take the variables I set in the program, and then write out one line of code to the text file... but it always only writes to the first line, and overwrites everything in the file, even what is on other lines. I need it to automatically go to the next empty line, and write there instead. Could you guys give me a hand?
(Time for bed. Zzz.... lol)
def applybutton(self, event):
X = XCOORD.GetValue()
Y = XCOORD.GetValue()
Z = YCOORD.GetValue()
B = BLOCK.GetValue()
file = open('Blueprints.txt','w')
file.write(', j ')
file.write(', k ')
1 Year Ago
Related Article:Reading two first line of the txt file?HOW?
is a Python discussion thread by tony75 that has 5 replies, was last updated 2 years ago and has been tagged with the keywords: line, python, reading, scripts.