newbie ``print`` question
Terry Reedy
tjreedy at udel.edu
Sun Sep 2 14:33:08 EDT 2012
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
More information about the Python-list
mailing list