#格式化输出 # % s d # name = input('请输入姓名') # age = input("请输入年龄") # height = input("请输入身高") # msg = "我叫%s,今年%s 身高 %s" %(name,age,height) # print(msg) name = input('请输入姓名:') age = input("请输入年龄:") job = input("请输入工作:") hobble = input('你的爱好:') msg = ''' _____________ info of %s ___________ Name : %s Age : %d job : %s Hobble: %s ______________ end _______________''' %(name,name,int(age),job,hobble) print(msg)
#想要在格式化输出中打印%,只要在%前加一个%号就行 name = input('请输入姓名') age = input("请输入年龄") height = input("请输入身高") msg = "我叫%s,今年%s 身高 %s 学习进度3%%" %(name,age,height) print(msg)