首页 > 代码库 > 崭新的一天-格式化输出

崭新的一天-格式化输出

name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")


info = ‘‘‘
-------  info of %s  ---------
Name:%s
Age:%s
Job:%s
Salary:%s

‘‘‘ %(name,name,age,job,salary)

print(info)

 

第二种方式:

name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")


info2 = ‘‘‘
-------  info of {_name}  ---------
Name:{_name}
Age:{_age}
Job:{_job}
Salary:{_salary}

‘‘‘.format(_name = name,
           _age=age,
           _job=job,
           _salary=salary)

print(info2)

 

崭新的一天-格式化输出