Python 2/3 Input 区别

来源:互联网 发布:知了软件 编辑:程序博客网 时间:2024/05/16 17:20

Python 2  里的input被识别成python表达式,所以输入的字符串会被识别为表达式,如果表达式未定义则会出现如下错误 “nameerror name is not defined”。在python2中需要使用raw_input在识别输入的字符串。

Python3里的input可以直接识别输入的字符串。


原创粉丝点击