"Write to a file" question please?

cmfinlay at SPAMmagnet.com.au cmfinlay at SPAMmagnet.com.au
Wed Jul 5 09:21:03 EDT 2000


number = 100
print "Number =", number
OUT = open("TT.txt","w")
OUT.write("Number =", number) # Error
OUT.close()

The code above gives the error.

Traceback (innermost last):
  File "ttest.py", line 5, in ?
    OUT.write("Number =", number)
TypeError: read-only buffer, tuple

OUT.write("Hello World")

Works but a number or variable of a number does not.

I have been reading documents on Python to no avail this time.
I am using Win98 with the latest python for this OS.

Any help would be much appreciated
E-mail me at cmfinlaySPAM at magnet.com.au
or reply here.



More information about the Python-list mailing list