Home >Backend Development >Python Tutorial >How to make output in one line in Python
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.
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=的用法
Rendering:
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!