Input () and raw_input () are all actually for the user to enter data, when the integer or floating-point number is recorded is not very different, because the user directly input raw data can be saved directly into the variable, for example:
>>> i = input (' I: ') i:123>>> print i123
However, when the user entered a string is a little trouble, we can not ask the user to enter the string to add (' "), so that is not the user experience is too bad? For example:
>>> s = input (' s: ') s: ' abc ' >>> print sabc>>>>>> s = input (' s: ') S:abctraceback (most Recent call last): File ' <stdin> ', line 1, in <module> file ' <string> ', line 1, in <module>namee Rror:name ' abc ' is not defined>>>
At this point, we need to consider the use of the Raw_input () function, the function is to put the input data as raw data, and then put in the string to save, we look at the effect:
>>> s = raw_input (' s: ') s:abc>>> print SABC
This article is from the "small white Plus small white" blog, please be sure to keep this source http://bxtser.blog.51cto.com/9259025/1671289
The difference between the input of Python and raw_input