In different python versions, the expression without line breaks is different. The following examples are given in python2 and python3 versions:
In Python2 In .x
The output in python2.x defaults to line wrapping. In order to suppress line wrapping, you can add a comma at the end of printing
In Python3.x
In python3, print becomes a function, and this syntax will not work.
We can use print(x, end="")
end="" to prevent the output from wrapping. The content between double quotes is the ending content, which can be a space or other characters. The default is line break
The above is the detailed content of What are the changes in output without line breaks in different python versions?. For more information, please follow other related articles on the PHP Chinese website!