Using the print command in Python3

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Tue Aug 10 03:58:27 EDT 2010


On Tue, 10 Aug 2010 00:17:03 -0500, Grady Knotts wrote:

> In earlier versions of Python I can do:
> 	print 'A',
> 	print 'B'
> to print everything on the same line: 'A B'
> 
> But I don't know how to do this with Python3 I've been trying things
> like:
> 	print('A',)
> 	print('B')
> and it prints two different lines.
> 
> So, do I get two different print statements to output on the same line?


print("Hello", end=' ')
print("world")


outputs:

Hello world


-- 
Steven



More information about the Python-list mailing list