Fred Drake committed a6f97e0

- show how to use file.write() with a non-string value
(closes SF bug #621057)
- add missing whitespace around assignment operator

Comments (0)

Files changed (1)

 >>> f.write('This is a test\n')
+To write something other than a string, it needs to be converted to a
+string first:
+>>> value = ('the answer', 42)
+>>> s = str(value)
+>>> f.write(s)
 \code{f.tell()} returns an integer giving the file object's current
 position in the file, measured in bytes from the beginning of the
 file.  To change the file object's position, use
 using the beginning of the file as the reference point.
->>> f=open('/tmp/workfile', 'r+')
+>>> f = open('/tmp/workfile', 'r+')
 >>> f.write('0123456789abcdef')
 >>>     # Go to the 6th byte in the file