python如果想输出原格式的内容,可以加''' ''',占位符使用方式

print('我考了%d分'%20)
msg='''
---------info of %s-----------
name: %s
age: %d                           #字符串不能放到%d处
job: %s
salary: %f
you will be retired in %s years   #数字可以放到%s处
---------end---------------
'''%('tom','tom',20,'it',3444.44,45)
print(msg)

猜你喜欢

转载自www.cnblogs.com/tuobei/p/9403571.html