Python的学习之旅———格式化输出

占位符 %s 和%d .%d只能是整数
# 练习:用户输入姓名、年龄、工作、爱好 ,然后打印成以下格式
# ------------ info of Egon -----------
# Name : Egon
# Age : 22
# Sex : male
# Job : Teacher
# ------------- end -----------------

name=input('请输入你么名字:')
age=int(input('请输入你的年龄:'))
sex=input('请输入你的性别:')
jobe=input('请输入你的工作:')
print('------------ info of Egon -----------\nName :%s\nAge :%d\nSex :%s\nJob :%s\n------------- end -----------------'
%(name,age,sex,jobe))
posted @ 2017-09-06 22:51  恩是的  阅读(174)  评论(0编辑  收藏  举报