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)统计字符串长度的用法。
转载于:https://blog.51cto.com/xiaodongge/1861339