【发布时间】:2023-03-19 09:27:01
【问题描述】:
我想在之前在 python 中打印过的另一个文本旁边打印一些文本 例如
print("Hello")
a="This is a test"
print(a)
我的意思是像这样打印“HelloThis is a test”而不是在下一行我知道我应该使用 print("Hello",a) 但我想使用单独的打印命令!!!!
【问题讨论】:
-
print("Hello%s" % a)也可以 -
或 print("Hello{}.format(a)) 使用新的(首选)
.format语法。
标签: python text python-3.x printing