Print a list to a string?

mrstephengross mrstephengross at hotmail.com
Thu Nov 1 11:09:06 EDT 2007


> >>> import cStringIO
> >>> s = cStringIO.StringIO()
> >>> print >>s, [1, 2, 1.0/5, 'hello world']
> >>> s.getvalue()

Thanks--this works perfectly!

-_Steve




More information about the Python-list mailing list