how to convert string
Scott David Daniels
scott.daniels at acm.org
Wed Apr 5 15:29:51 EDT 2006
Ben C wrote:
> ... But this puts an extra space on the end (so did the print i,
> version above).
Actually, no (the trailing-comma prints do a funny dance).
Check it out:
from StringIO import StringIO
dest = StringIO()
for i in range(10):
print >>dest, i,
print >>dest
print repr(dest.getvalue())
prints:
'0 1 2 3 4 5 6 7 8 9\n'
--
-Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list