If the prompt argument is present, it is written to standard output
without a trailing newline. The function then reads a line from input,
converts it to a string (stripping a trailing newline), and returns
that. When EOF is read, EOFError is raised.
这是因为使用
raw_input
,输入是raw,表示一个字符串:raw_input
返回一个字符串,应使用float()
将输入转换为float:注意错误消息
TypeError: unsupported operand type(s) for /: 'str' and 'float'
如果2.20462是一个浮点数,那么这里哪一个是字符串?文档对raw_input说了些什么?在
相关问题 更多 >
编程相关推荐