Home > Article > Backend Development > The difference between raw_input() and input()
text = raw_input("Enter a string:") treats the user's input as a string (str), that is, text is a string.
num = input("Enter a number:") treats the user's input as a number (int or float), that is, num is a number.
Test:
>>>text = raw_input("Enter a string:")
Enter a string: hello
>>> print type(text)
Output: < ;type 'str'>
>>>num = input("Enter a number:")
Enter a number:12.4
>>>print type(num)
output: