Skip to main content
Minor formatting improvement: only H1 on the page should be question title
Source Link
wjandrea
  • 34k
  • 10
  • 69
  • 105

Python 2:

Python 2:

  • 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.

Python 3:

Python 3:

  • raw_input() was renamed to input() so now input() returns the exact string.
  • Old input() was removed.

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 eval(input()).

Python 2:

  • 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.

Python 3:

  • raw_input() was renamed to input() so now input() returns the exact string.
  • Old input() was removed.

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 eval(input()).

Python 2:

  • 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.

Python 3:

  • raw_input() was renamed to input() so now input() returns the exact string.
  • Old input() was removed.

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 eval(input()).

Python 2:

  • 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.

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() so now input() returns the exact string.
  • Old input() was removed.

raw_input() was renamed to input() and the old input() was removed. If you want to use the old input(), meaning you canneed to evaluate a user input as a python statement, you have to do it manually by using eval(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()).

Python 2:

  • 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.

Python 3:

  • raw_input() was renamed to input() so now input() returns the exact string.
  • Old input() was removed.

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 eval(input()).

clarified that raw_input only exists in python 2
Source Link

Python 2:

raw_input()raw_input() takes exactly what the user typed and passes it back (string)as a string. input()input() takes the raw_input()raw_input() and performs an eval()eval() on it as well. In actual fact:

input() <---> eval( raw_input() ) 

The main difference is that input()input() expects a syntactically correct python statement where raw_input()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()).

raw_input() takes exactly what the user typed and passes it back (string). input() takes the raw_input() and performs an eval() on it as well. In actual fact:

input() <---> eval( raw_input() ) 

The main difference is that input() expects a syntactically correct python statement where raw_input() does not.

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()).

added 4 characters in body
Source Link
Mariusz Jamro
  • 31.9k
  • 25
  • 129
  • 170
Loading
Source Link
screenglow
  • 1.9k
  • 5
  • 21
  • 23
Loading