On Jun 10, 2:01 am, [EMAIL PROTECTED] wrote:
> Hello all,
>
> New user to python. I can write to a file, however, I would like to
> do both...whatever I do on the screen, I'd like to write it to a file.
>
> any pointers on where I can find this info.
>
> thanks,
Something like this, perhaps?
class Storage(object):
def __init__(self, the_file):
self.the_file = the_file
def write(self, message):
import sys
sys.stdout.write(message)
self.the_file.write(message)
my_file = open("my_text.txt", "w")
store = Storage(my_file)
print >> store, "Hello world!"
my_file.close()
--
http://mail.python.org/mailman/listinfo/python-list