方法一:
username=input('username:')
age=input('age:')
job=input('job:')
salary=input('salary') info1='''
-----------------------info of %s----------------------------
Name:%s
Age:%s
Job:%s
Salary:%s
''' %(username,username,age,job,salary) print(info1)
方法二:
username=input('username:')
age=input('age:')
job=input('job:')
salary=input('salary:') info2='''
---------------------------------info of {_name}------------------
Name:(_name)
Age:{_age}
Job:{_job}
Salary:{_salary}
'''.format(_name=username,
_age=age,
_job=job,
_salary=salary) print(info2)
方法三:
username=input('username:')
age=input('age:')
job=input('job:')
salary=input('salary:') info3='''
---------------------------------info of {0}---------------------
Name:{0}
Age:{1}
Job:{2}
Salary:{3}
'''.format(username,age,job,salary) print(info3)