print() a list

AggieDan04 danb_83 at yahoo.com
Sat Sep 5 05:33:37 EDT 2009


On Sep 5, 1:51 am, Dero <pict... at gmail.com> wrote:
> On Sep 5, 2:35 pm, "Mark Tolonen" <metolone+gm... at gmail.com> wrote:
>> > "DarkBlue" <pict... at gmail.com> wrote in message
>> >news:b9c0c4ac-5f8f-4133-b928-9e55ab4b22a0 at x5g2000prf.googlegroups.com...
>> > >I am trying to get used to the new print() syntax prior to installing
> > > python 3.1:
...
> > Without the following statement, print does not work the "new" way.  What
> > you are printing is a tuple of the two list elements.
>> > from __future__ import print_function
...
> I thought in 2.6 both print and print() were equally implemented
> without the future import requirement.

That couldn't be done because the print() syntax can't be
distinguished from old-style print with a tuple.
~$ python2.6 -c "print(1, 2)"
(1, 2)
~$ python3.0 -c "print(1, 2)"
1 2


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /