%s表示占位符,把s替换成d表示整数,把s替换成f 表示浮点。
name = input("name:")
age = int(input("age:"))
job = input("job:")
salary = input("salary:")
msg = ‘‘‘
------------info of %s----------------------
name: %s
age: %s
job: %s
salary: %s
you well be retired %s years #变量age加了int为转化类型
-------------end-------------------------------
‘‘‘ % (name,name,age,job,salary,70-age) #对应格式内的位置
print(msg)
原文地址:https://www.cnblogs.com/MUQINGFENG123/p/9563279.html
时间: 2024-10-11 07:22:21