[Tutor] Saving file changes to output
Wed, 2 Aug 2000 19:14:08 +0200
On Wed, Aug 02, 2000 at 12:54:46PM -0400, Daniel D. Laskey, CPA wrote:
> # rebuild the file using the new position  with double quotes
Instead of this, put:
> #Traceback (innermost last):
> # File "today.py", line 15, in ?
> # out_file.write(line,f3)
> #TypeError: read-only buffer, tuple
> My objective is to write the changes I made to the data to my out_file. When I
> put a print statement after the f3 the file looks fine. I just can't get it to print
> to the junk2.txt file properly.
Just use out_file.write(f3), not (line,f3). That writes the line "f3" to
the file. You need to add a "\n" to f3 too, to go to the next line.
If you write write(line,f3), Python thinks you send the function a tuple, and
it doesn't work.
Remco Gerlich, firstname.lastname@example.org