【发布时间】:2012-12-31 13:08:58
【问题描述】:
在 Python 2.7 中:
a=80
b=100
def status(hp, maxhp):
print "You are at %r percent health." % hp*100/maxhp
status(a,b)
返回:
TypeError: /: 'str' 和 'int' 的操作数类型不受支持
我已经尝试在每个变量和每个变量组合周围放置 int()。
【问题讨论】:
标签: python string types int typeerror