-4

is the 'input ()' function used to input an integer? And the raw_input () function is used to input a string?

  • When you type in a question, it shows you similar questions in the box. Try reading them first. – will Mar 08 '15 at 12:04
  • 1
    Although [this post](http://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x) is tagged with python 3, the answers also reference python 2 and might be helpful. – Lix Mar 08 '15 at 12:05
  • 1
    Not quite. `raw_input()` is used to input a string, `input()` is used to input danger. :) `input()` in Python 2 invokes the `eval()` function, and that can be dangerous - see [Eval really is dangerous](http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html) by SO member Ned Batchelder. That article covers some advanced Python concepts, but it may help you understand that using `eval()` on random user input is not wise. – PM 2Ring Mar 08 '15 at 12:47

1 Answers1

2

input evaluates the input, while raw_input does not.

For example, capturing the input 5, returns the int 5. However, capturing the raw_input 5, returns the str '5'

inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241