拼接:
name=zhuhuan
age=23
salary=333
info=‘‘‘
----- info of %s-----
age:%s
name:%s
salary:%s
%(name,age,name,salary)
‘‘‘
info2=‘‘‘
----- info of {_name}-----
age:{_age}
name:{_name}
salary:{_salary}
‘‘‘.format(_name=name,_age=age,_salary=salary)
info3=‘‘‘
----- info of {0}-----
age:{1}
name:{0}
salary:{2}
‘‘‘.format(name,age,salary)
print(info,info2,info3)
时间: 2024-10-05 05:58:25