newbie ``print`` question

gwhite gwhite at ti.com
Sun Sep 2 15:18:00 EDT 2012


On Sep 2, 11:33 am, Terry Reedy <tjre... at udel.edu> wrote:
> On 9/2/2012 1:23 PM, gwhite wrote:
>
> > I can't figure out how to stop the "add a space at the beginning"
> > behavior of the print function.
>
> >>>> print 1,;print 2,
> > 1 2
>
> You have discovered why print is a function in 3.x.
>  >>> print(1, 2, sep='')
> 12
>  >>> print(1, end=''); print(2, end='')
> 12
>
> In 2.6 or 2.7, you can add
>    from __future__ import print_function
> but I recommend using 3.2 or 3.3 unless you have a reason to use older
> Python.
>
> --
> Terry Jan Reedy

Thanks.  I would use 3.2 or 3.3, but I am actually using pythonxy,
which hasn't quite gotten there yet, as the bundle of packages has to
all play nice together. Or so I am guessing.   I have been considering
the __future__ technique.



More information about the Python-list mailing list