python字符串打印-不同方法vars

book = "library2"
pages = 350

print("the %(book)s book contains more than %(pages)s scripts"%vars())

the library2 book contains more than 350 scripts

猜你喜欢

转载自www.cnblogs.com/chillytao-suiyuan/p/12176142.html