Python: raw_input vs input

Python 2:

raw_input() takes exactly what the user typed and passes it back as a string. input() takes the raw_input() and performs an eval() on it as well. The main difference is that input() expects a syntactically correct python statement where raw_input() does not.

Python 3:

raw_input() was renamed to input() and the old input() was removed. If you want to use the old input(), you can do eval(input()).

 

SOURCEhttp://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s