Python 2.3.4 (#1, Feb 2 2005, 11:44:13) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9. EL4)] on linux2type "help", "Copyright", "Credits" or "License" for more information. >>> user = raw_input ("Please input:") Please input: Wei # raw_input string succeeded >>> user 'wei' >>> user = input ("Please input :") please input: 123 # The input number is successfully entered (the number is returned) >>> user123 >>> user = Raw_input ("Please input:") Please input: 111 # raw_input: The number is successfully input (returned as a string) >>> user '000000' >>> user = input (" Please input :") please input: Wei # traceback (most recent call last): file "
", line 1, in? File "
", line 0, in? Nameerror: Name 'wei' is not defined
Python 2.7.3 same as above
In Python 3.2.3, the input and raw_input are integrated, without raw_input.
Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32type "help", "Copyright ", "Credits" or "License" for more information. >>> user = raw_input ("Please input:") # raw_inputtraceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'raw _ input' is not defined >>> user = input ("Please input:") Please input: wei >>> user 'wei' >>> user = input ("Please input:") # The output result of input is as the string please input: 123 >>> user '123'