raw_input的功能,总的来说,就一句: 将输入的内容读入,并且可以将其赋给相关的变量。
具体的说来,可将此功能用于一下几个方面:
function 1. just simply put in a value, which will be assigned to certain variable(variables). And this function is to some extent similar as the <cin>functions in C++ programming language:
```
var_type var_1;
cout <<"input the first variable:";
cin>>var_1;
```
accordingly, in python programming, we have the similar useage as follows:
```
print"how old are you?",
age = raw_input()
```
Pay attention to the 'comma<,>’at the end of <print ... ...>sentence, which is used to temporarily suspend the <print>operation, until a value is given to variable <a>,and by putting in the value of <a> with your keyboard, this value can be meanwhile shown on the terminal.
The running results is the following:
![](https://img-blog.csdn.net/20160827085713269)
![](https://img-blog.csdn.net/20160827085412771)
An <Enter>press-button operation was conducted after inputting the age, after which the variable 'a' was given a value of '465465'. And if you want to print variable 'a', this value will be on the terminal(in general , a screen,hahaha...).Example is given in the following:
```
print"How old are you?",
#please keep in mind not leaving out the comma<,>
#if you want to input a value by means of reminding,
#ie, a scentence shown on the screen tells you to input something ,and you input it.
age= raw_input();
print "How tall are you?",
height = raw_input();
print "you are %r old, and %r tall."%(age, height)
```
*Running output:*
![](https://img-blog.csdn.net/20160827091537012)
<Note: if you do not want input value by reminding scentences, you can also use raw_input( ) like the following:
```
year = raw_input();
print "year now is: %r" %year
```
*Running output:*
![](https://img-blog.csdn.net/20160827093700003)![](https://img-blog.csdn.net/20160827093713819)
>
**function 2.** using raw_input( ) scentences to remind others somthing:
```
age = raw_input("How old are you? ")
height = raw_input("how tall are you? ")
print "you are %r old and %r tall" %(age, height)
```
*Running output:*
![](https://img-blog.csdn.net/20160827095921910)
![input the variable<age>](https://img-blog.csdn.net/20160827095951302)
![after input, press <Enter>button](https://img-blog.csdn.net/20160827100046142)
![input the variable<height>, and then press <Enter >button](https://img-blog.csdn.net/20160827100150252)
another form of reminding: using some peculiar characters as the reminding part
example:
prompt = '>>> ' print "What kind of computer do you have?" computer = raw_input(prompt) print "You said you have a %r " %computer
Running output:
(use 'prompt' characters(>>>)as a reminding to inform others input value for certain varaibles)