[Tutor] class Writer

Alan Gauld alan.gauld at freenet.co.uk
Thu May 25 06:13:17 CEST 2006


> I understand that the class is taking the strings from
> stdout (supplied by the print statements) and writing
> them to a text file.  Does the user need to explicitly
> call the write function?  For example:
> 
> sys.stdout = Writer('tmp.log').write(whatever the
> message is)

No, that's what print does.
The Writer is replacing the stdout file-like object with 
your Writer file-like object. print just uses whatever 
file-like object is connected to stdout.

Alan G.



More information about the Tutor mailing list