buhong 发表于 2017-4-28 10:05:37

python中input与raw_input区别

input()
等同于 eval(raw_input(prompt)).

警告:input的输入要求是一个有效的python表达式.

文档原文:
This function is not safe from user errors! It expects a valid Python expression as input; if the input is not syntactically valid, a SyntaxError will be raised. Other exceptions may be raised if there is an error during evaluation. (On the other hand, sometimes this is exactly what you need when writing a quick script for expert use.)
页: [1]
查看完整版本: python中input与raw_input区别