"print X," Equivalent In Python3
Basically, I want to print out a string of values in a single line, in Python2 a statement like this one would suffice: print x, How to write the same simple statement in Python3
Solution 1:
>>>print(1, end=' '); print(2)
1 2
For further enlightenment:
>>>help(print)
Solution 2:
Here is an explanation from the following site:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html
See the section called "Print Is A Function."
Old: print x, # Trailing comma suppresses newline
New: print(x, end=" ") # Appends a space instead of a newline
Solution 3:
In Python 3.x you would say:
print(x, end='')
Not sure what you mean by 'special formatting'.
Post a Comment for ""print X," Equivalent In Python3"