Home  >  Article  >  Backend Development  >  What are the changes in output without line breaks in different python versions?

What are the changes in output without line breaks in different python versions?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-11 10:40:022758browse

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

What are the changes in output without line breaks in different python versions?

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

What are the changes in output without line breaks in different python versions?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn