-4

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

3
  • When you type in a question, it shows you similar questions in the box. Try reading them first. Commented Mar 8, 2015 at 12:04
  • 1
    Although this post is tagged with python 3, the answers also reference python 2 and might be helpful. Commented Mar 8, 2015 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 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. Commented Mar 8, 2015 at 12:47

1 Answer 1

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'

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.