close

[Solved] Python TypeError: not enough arguments for format string

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Python TypeError: not enough arguments for format string in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Python TypeError: not enough arguments for format string Error Occurs?

Today I get the following error Python TypeError: not enough arguments for format string in python.

How To Solve Python TypeError: not enough arguments for format string Error ?

  1. How To Solve Python TypeError: not enough arguments for format string Error ?

    To Solve Python TypeError: not enough arguments for format string Error I got the same error when using % as a percent character in my format string. The solution to this is to double up the %%.

  2. Python TypeError: not enough arguments for format string

    To Solve Python TypeError: not enough arguments for format string Error I got the same error when using % as a percent character in my format string. The solution to this is to double up the %%.

Solution 1

I got the same error when using % as a percent character in my format string. The solution to this is to double up the %%.

Solution 2

You need to put the format arguments into a tuple (add parentheses):

instr = "'%s', '%s', '%d', '%s', '%s', '%s', '%s'" % (softname, procversion, int(percent), exe, description, company, procurl)

What you currently have is equivalent to the following:

intstr = ("'%s', '%s', '%d', '%s', '%s', '%s', '%s'" % softname), procversion, int(percent), exe, description, company, procurl

Example:

>>> "%s %s" % 'hello', 'world'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string
>>> "%s %s" % ('hello', 'world')
'hello world'

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read