为了账号安全,请及时绑定邮箱和手机立即绑定

如何连接str和int对象?

如何连接str和int对象?

侃侃尔雅 2019-06-26 13:58:14
如何连接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我怎样才能解决这个问题?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 925 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信