python 格式化方法 从其他信息构建字符串 算法工程师的学习日志 2021-06-17 84 阅读1分钟 str = "{0} + {1} = {2},这是模拟一个等式{3}".format(1, 2, 3, "True") print(str) d1 = 2 str1 = "共%d个图片,无效图片数为%s" % (d1, 2) print(str1) 通过python的format函数