Home > Backend Development > Python Tutorial > How to make output in one line in Python

How to make output in one line in Python

(*-*)浩
Release: 2019-07-20 09:36:18
Original
30194 people have browsed it

The default print in python is to print one line with a newline at the end. Adding end=" " means no line break at the end and adding a space. In fact, this is also a grammatical requirement, indicating that the statement is not over.

How to make output in one line in Python

Tips: In Python, how to make statements output on the same line: end= (recommended learning: Python video tutorial)

As the title says, the specific effects and codes are as follows:

print("你好你叫什么名字?")
print("我叫张三")
print("你好,张三,我叫李四")

#语句输出在同一行
print("你好你叫什么名字?",end="")
print("我叫张三!",end="")
print("你好,张三,我叫李四",end="")

#end=的用法
Copy after login

Rendering:

How to make output in one line in Python

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to make output in one line in Python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template