Re: print() a list

2009-09-05 Thread AggieDan04
On Sep 5, 1:51 am, Dero wrote: > On Sep 5, 2:35 pm, "Mark Tolonen" wrote: > > > "DarkBlue" wrote in message > > >news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... > > > >I am trying to get used to the new print() syntax prior to installing > > > python 3.1: ... > > Without

Re: print() a list

2009-09-04 Thread Dero
On Sep 5, 2:35 pm, "Mark Tolonen" wrote: > "DarkBlue" wrote in message > > news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... > > > > >I am trying to get used to the new print() syntax prior to installing > > python 3.1: > > > test=[["VG", "Virgin Islands, British"],["VI", "

Re: print() a list

2009-09-04 Thread Mark Tolonen
"DarkBlue" wrote in message news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... I am trying to get used to the new print() syntax prior to installing python 3.1: test=[["VG", "Virgin Islands, British"],["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],["EH", "We

Re: print() a list

2009-09-04 Thread Mark Tolonen
"DarkBlue" wrote in message news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... I am trying to get used to the new print() syntax prior to installing python 3.1: test=[["VG", "Virgin Islands, British"],["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],["EH", "We

Re: Print a list to a string?

2007-11-01 Thread mrstephengross
> >>> import cStringIO > >>> s = cStringIO.StringIO() > >>> print >>s, [1, 2, 1.0/5, 'hello world'] > >>> s.getvalue() Thanks--this works perfectly! -_Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Print a list to a string?

2007-10-31 Thread Steven D'Aprano
On Wed, 31 Oct 2007 22:17:48 +, mrstephengross wrote: > I would like to get the results of a print operation placed in a string. s = str(x) If you specifically need to capture the output of print, then something like this: >>> import cStringIO >>> s = cStringIO.StringIO() >>> print >>s,

Re: Print a list to a string?

2007-10-31 Thread Bruno Desthuilliers
mrstephengross a écrit : > I would like to get the results of a print operation print is a statement, it doesn't yield any 'result'. > placed in a > string. For instance, you can very easily create a list and print it > to stdout: > > x = [1,2,3] > print x # Will print [1,2,3] > > What if

Re: Print a list to a string?

2007-10-31 Thread Gary Herron
mrstephengross wrote: > I would like to get the results of a print operation placed in a > string. For instance, you can very easily create a list and print it > to stdout: > > x = [1,2,3] > print x # Will print [1,2,3] > > What if I want the text "[1,2,3]" placed in a string? For instance, > s