> 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 pr
On Wed, 24 May 2006, Christopher Spears wrote:
> I've been working my way through an online tutorial and came across the
> following sample script:
>
> import sys
>
> class Writer:
>def __init__(self, filename):
>self.filename = filename
>def write(self, msg):
>f = file(
I've been working my way through an online tutorial
and came across the following sample script:
import sys
class Writer:
def __init__(self, filename):
self.filename = filename
def write(self, msg):
f = file(self.filename, 'a')
f.write(msg)
f.close()
sys.s