输出样式为:
---------Info of aaa--------
name:aaa
age:23
job:IT
salary:20000
方法一:
name =input("name:") age =input("age:") job =input("job:") salary =input("salary:") info = ---------Info of %s--------''' name:%s age:%s job:%s salary:%s #s =string #d =digit #f =float '''%(name,name,age,job,salary) print(info)
方法二:
name =input("name:") age =input("age:") job =input("job:") salary =input("salary:") info = ---------Info of {_name}--------''' name:{_name} age:{_age} job:{_job} salary:{_salary} '''.format(_name=name, _age=age, _job=job, _salary=salary) print(info)
方法三:
name =input("name:") age =input("age:") job =input("job:") salary =input("salary:") info =''' ---------Info of {0}-------- name:{0} age:{1} job:{2} salary:{3} '''.format(name,age,job,salary) print(info)
提醒:input输出来的只能是字符串