StringIO in 2.6 and beyond
Bill McClain
20080915.20.wmcclain at spamgourmet.com
Tue Dec 9 13:41:26 EST 2008
On 2008-12-09, Peter Otten <__peter__ at web.de> wrote:
> >>> out = io.StringIO()
> >>> print(u"hello", file=out, end=u"\n")
> >>> out.getvalue()
> u'hello\n'
That has the benefit of working. Thank you!
That can't be the intended behavior of print(), can it? Insering non-unicode
spaces and line terminators? I thought all text was unicode now. Or is that
only in 3.0?
-Bill
--
Sattre Press History of Astronomy
http://sattre-press.com/ During the 19th Century
info at sattre-press.com by Agnes M. Clerke
http://sattre-press.com/han.html
More information about the Python-list
mailing list