format报错

TypeError: not enough arguments for format string

将字符串中的%替换为%%,达到转义的效果

a = "测试字符串中自带%%时遇到错误的问题%s"%format

这里前面的%的前面必须要加一个%用以转义,不然就会报错。

原文地址:https://www.cnblogs.com/qiaoer1993/p/11138289.html