Python错误TypeError not enough arguments for format string

2019-11-04
#Python

错误:

instr = “’%s’, ‘%s’, ‘%d’, ‘%s’, ‘%s’, ‘%s’, ‘%s’” % softname, procversion, int(percent), exe, description, company, procurl

解决方案:

instr = “’{0}’, ‘{1}’, ‘{2}’, ‘{3}’, ‘{4}’, ‘{5}’, ‘{6}’".format(softname, procversion, int(percent), exe, description, company, procurl)

参考