Python实践归纳 | 如何让两个print()函数打印在一行内?

解:可以利用end参数,将默认的换行符改为空格或是空白即可

例如:

print('hello', end = " ")
print('world', end = "*")
print('!')
"""
输出结果是:
hello world*!
"""

猜你喜欢

转载自blog.csdn.net/Neutionwei/article/details/107600052