What's the difference between `raw_input()` and `input()` in Python 3?
The difference is that
raw_input() does not exist in Python 3.x, while
input() does. Actually, the old
raw_input() has been renamed to
input(), and the old
input() is gone, but can easily be simulated by using
eval(input()). (Remember that
eval() is evil. Try to use safer ways of parsing your input if possible.)
raw_input()takes exactly what the user typed and passes it back as a string.
input()first takes the
raw_input()and then performs an
eval()on it as well.
The main difference is that
input() expects a syntactically correct python statement where
raw_input() does not.
raw_input()was renamed to
input()returns the exact string.
If you want to use the old
input(), meaning you need to evaluate a user input as a python statement, you have to do it manually by using