Python TypeError:格式字符串的参数不足(Python TypeError: not enough arguments for format string)
这是输出。 这些是utf-8字符串我相信...其中一些可以是NoneType,但它会立即失败之前,像...
instr = "'%s', '%s', '%d', '%s', '%s', '%s', '%s'" % softname, procversion, int(percent), exe, description, company, procurlTypeError:格式字符串的参数不足
其7为7虽然?
Here's the output. These are utf-8 strings I believe... some of these can be NoneType but it fails immediately, before ones like that...
instr = "'%s', '%s', '%d', '%s', '%s', '%s', '%s'" % softname, procversion, int(percent), exe, description, company, procurlTypeError: not enough arguments for format string
Its 7 for 7 though?
最满意答案
请注意,格式化字符串的%语法已变得过时。 如果您的Python版本支持,您应该写:
instr = "'{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}'".format(softname, procversion, int(percent), exe, description, company, procurl)这也修复了您遇到的错误。
Note that the % syntax for formatting strings is becoming outdated. If your version of Python supports it, you should write:
instr = "'{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}'".format(softname, procversion, int(percent), exe, description, company, procurl)This also fixes the error that you happened to have.
更多推荐
发布评论