【发布时间】:2013-05-15 18:16:10
【问题描述】:
我正在学习python,这是一段代码:
x = raw_input('Enter a numerator:')
y = raw_input('Enter a denominator:')
print x / y
这给了我一个错误:
Traceback (most recent call last):
line 3, in <module>
print x / y
TypeError: unsupported operand type(s) for /: 'str' and 'str'
【问题讨论】:
-
错误清楚地表明:你不能分割两个字符串。之前转换为int!