name = input("name:")
age = int(input("age:"))
job = input("job:")
salary = input("salary:")
if salary.isdigit(): #判断是否为数字
salary = int(salary)
else:
exit("must input dight") #退出程序
msg = '''
------massage: %s----
Name: %s
Age: %d
Job: %s
Salary: %s
-------end-----------
''' % (name,name,age,job,salary)
print(msg)
Python学习日记-6-格式化输出
最新推荐文章于 2024-10-19 10:15:14 发布