Why does python print() print without line breaks? There are differences in different versions of python, and there are obvious differences between Python2 and Python3. Let me introduce to you the differences between the two.
In Python2.x
The output in python2.x defaults to newline. In order to suppress newline, you can print at the end Add a comma
Recommended manual:Python basic introductory tutorial##Related recommendations: "
Python Video Tutorial"
In Python3.x
In python3, print becomes a function, this This syntax won't work.Recommended manual: Python 3 TutorialWe can use print(x, end="")end= "" prevents the output from wrapping. The content between the double quotes is the ending content. It can be a space or other characters. The default is line break
Related articles recommend: 1.
How to wrap lines when writing in python 2.
How to wrap python print
Related video recommendations: 1.
2019python self-study video 2.
Python Web Getting Started Video Tutorial3.
python Getting Started Video Tutorial
The above is the detailed content of Why does python print() print without line breaks?. For more information, please follow other related articles on the PHP Chinese website!