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_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.
© 2022 - 2024 — McMap. All rights reserved.
input
)... there's a rude answer for that, it's rtfm, I've just avoided that, but can I politely pour the doubt so that people may think they need to inspect the problem more deeply to get what's going on while waiting for an actual help? I did so, or so I think. Very likely, failed. Enlightening it's such a hard matter. – Hydromedusainput()
in Python 2. If you typee
at the prompt, you will get an error, so it doesn't "work fine". – Predicament