【发布时间】:2022-07-24 04:54:54
【问题描述】:
第一个代码运行正确,但第二个代码运行不正确。这里有什么问题?
>>> print("%d" %100,100)
100 100
>>> print("%d" %(100,100))
Traceback (most recent call last):
File "<pyshell#96>", line 1, in <module>
print("%d" %(100,100))
TypeError: not all arguments converted during string formatting
【问题讨论】:
-
欢迎来到 SO。
print("%d" % (100, 100))期望你有两个参数.. 像%d %d的打印格式。
标签: python