好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

来自Python input()函数的NameError

参见英文答案 > error in python d not defined.                                     3个

input_var = input ("Press 'E' and 'Enter' to Exit: ")

NameError: name 'e' is not defined

我使用的是Python 2.5.我怎么能克服这个错误?

输入读取并评估Python表达式.当它试图评估它时,它会查找未定义的变量e,并且失败.

您几乎总是希望使用raw_input. (和in Python3, input has this behaviour.)

或者,更好的是,在Unix上,使用readline,以便用户可以编辑他们的输入.

查看更多关于来自Python input()函数的NameError的详细内容...

  阅读:18次