문제

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

NameError: name 'e' is not defined

I am using Python 2.5. How I can overcome this error?

도움이 되었습니까?

해결책

input reads and evaluates a Python expression. When it tries to evaluate it, it looks for a variable e, which is not defined, and fails.

You almost always want to use raw_input instead. (And in Python3, input has this behaviour.)

Or, better, on Unix, use readline so the user can edit their input.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top