如何连接str和int对象?如果我试图做以下几件事:things = 5print("You have " + things + " things.")我在Python3.x中得到了以下错误:Traceback (most recent call last):
File "<stdin>", line 1, in <module>TypeError: must be str, not int..Python 2.x中也有类似的错误:Traceback (most recent call last):
File "<stdin>", line 1, in <module>TypeError: cannot concatenate 'str' and 'int' objects我怎样才能解决这个问题?
添加回答
举报
0/150
提交
取消