一:请输入名片 (姓名,年龄,职业,爱好)设计名片
name=input('你的名字') age=input('你的年龄') job=input('你的工作') hobbie=input('你的爱好') msg=''' inof of %s name:%s age:%s job:%s hobbie:%s end ''' %(name,name,age,job,hobbie) print(msg) 二:%的使用
name=input('你的名字') age=input('你的年龄') height=input('你的身高') msg='''我叫%s,我的年龄是%d,学习进度是%%3,我的身高是%s, ''' %(name,int(age),height) print(msg) # 我的年龄是如果输入%s %(name,age,height)
# 我的年龄是如果输入%d %(name,int(age),height)