python2 print does not wrap
Finally, add a comma in print, the two outputs will print on the same line, but there is a space interval between the two outputs, such as:
print '{0}'.format(123),
print '{0}'.format(456)
Output:
123 456
If there is no comma:
print '{0}'.format(123)
print '{0}'.format(456)
Output:
123
456
python3 print does not wrap
python3 end of print parameters function default value '\ n', represents a new line, assigned to the empty end, it will not wrap, for example:
print (123,end='')
print (456,end='')
Output:
123456
python2 print does not wrap another implementation
python2 in the first line of the file plus from __future__ import print_function, can also be used to achieve python3 way to end the parameters assigned null (value) of the output does not wrap:
from __future__ import print_function
print (123,end='')
print (456,end='')
Output:
123456
【转】https://blog.csdn.net/dcrmg/article/details/79091926