最佳答案
如果我尝试做以下事情:
things = 5
print("You have " + things + " things.")
我在 Python3.x 中得到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "int") to str
... 在 Python2.x 中也有类似的错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'int' objects
我怎样才能解决这个问题呢?