How can I show the output of two print statements on the same line?

python

Solution

In python 1.x and 2.x, a trailing comma will do what you want (with the caveat mentioned by others about the extra space inserted):

print "123",
print "456"

In python 3.x — or in python 2.6-2.7 with `from __future__ import print_function` — `print` is a function and you should use `end=""` to force no extra ending character:

print("123", end="")
print("456")

Problem

I have 2 separate print statements: print "123" print "456" How can i make these 2 print statement appear on the same line? Note i need to use 2 print statements output: 123456

Original source

Related problems