What is the difference between input and raw_input in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between input and raw_input in python?

10th Jul 2016, 1:08 AM
Deekshith
2 Answers
0
"raw_input" is used in python 2.x and "input" is used in python 3.x versions.
12th Jul 2016, 8:16 AM
Sumit Choudhary
Sumit Choudhary - avatar
0
(I think) if you use raw_input() python sees the data that is put in via this function as a string, but if you use input() python looks into the data that is put in and uses it as it is. So if you put in '123' with input() python does see this as an integer instead of a string. these functions are written different in python 2 and 3. (the first ones are python 2) raw_input() -> input() input() -> eval(input()) hope you understand it now, and sorry for my vocabulary faults (i'm not an englishman)
20th Jul 2016, 6:58 PM
speedycoder