I am trying to write to a file multiple times before close. Using the following sequence:
outfile = open(data_file, 'w' )
while x > 0
x = x - 1
datax is read from a file.
outfile.write('%25s' %datax + "|\n")
This loop will write 5 lines at column position 25. I later come back to the same code and want to write 5 more lines at column 50 starting on line 1 and not line 6.
My questions are:
1. how can I format outfile so i can write multiple lines and then apend multiple lines later before closing the file?
2. how can I make data formatting string '%25s' intiger (in this case 25) a variable?
Thanks in advance.