[Python-bugs-list] [ python-Bugs-621057 ] File write examples are inadequate

noreply@sourceforge.net noreply@sourceforge.net
Wed, 09 Oct 2002 15:39:34 -0700


Bugs item #621057, was opened at 2002-10-09 16:39
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=621057&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Stagg (kandrew)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: File write examples are inadequate

Initial Comment:
The examples provided for writing to files in 
section 7.2 of the documentation are overly simple 
showing only writing of a static string.  Reading 
through 7.1 (although not actually discussing file 
I/O) helps a little as the % operator is mentioned 
but the "...C sprintf()-style format string..." 
specifiers which are valid aren't cross referenced 
(and the 'Library Reference' is a largish search 
area).  I had to find out experimentally that %f isn't 
valid although %d is.  To date, I haven't been able 
to experimentally findout how to print a list or 
tuple.

trying:
  file.write('"%s"', str(relatedMeasurements))

results in:
  TypeError: read-only buffer, tuple

The addition of examples printing a list or tuple 
would be extremely helpful.  Similarly, examples of 
using file.write() to produce print type output 
would be very illuminating.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=621057&group_id=5470