1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name = raw_input ( 'pelase input your name:' )
age = raw_input ( 'pelase input your age:' )
job = raw_input (pelase  input  your jobs:)
test =  """
     name : %s
     age    : %s
     job     : %s
"""  % (name,age,job)
      
print  test
 
print  type (age)   #测试输入的字符类型。
 
if  int (age)> = 30
     print  "you are too old!"
else
        print  "you are very young!"
 
重点:
age = int ( raw_input ( 'pelase input your age:' ))
int (age)的用法:强制转换字符串为数字大小。 str 为字符串, int 为数字大小。
  
age   =  raw_input ( 'pelase input your age:' ).strip()
print  len (age)
 
.strip()跳过空格的用法。
print  len (age)统计字符串长度的用法。