StringIO in 2.6 and beyond
Bill McClain
20080915.20.wmcclain at spamgourmet.com
Tue Dec 9 11:48:26 EST 2008
On 2008-12-09, pruebauno at latinmail.com <pruebauno at latinmail.com> wrote:
> This puzzles me too. According to the documentation StringIO accepts
> both byte strings and unicode strings. Try to replace
> output.write('First line.\n')
> with
> output.write(unicode('First line.\n'))
> or
> output.write(str('First line.\n'))
> and see if one of those works.
This works:
output.write(unicode('First line.\n'))
..but this generates the error:
print(unicode('Second line.'), file=output)
-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