>>> import sys
>>> class stuff:
...       things = []
...       def write(self, string):
...               self.things.append(string)
...
>>> def_stdout = sys.stdout
>>> sys.stdout = stuff()
>>> print 'this is a string.'
>>> print 'This is another string.'
>>> sys.stdout = def_stdout
>>> print stuff.things
['This is a string.', '\n', 'This is another string.', '\n']

Where are the newline characters coming from?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to