Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,970 questions

51,912 answers

573 users

How to fix TypeError: not enough arguments for format string in Python

3 Answers

0 votes
a = 4
b = 7
c = 9

# TypeError: not enough arguments for format string
# s = "a = %s b = %s c = %s" % a, b ,c

s = "a = %s b = %s c = %s" % (a, b ,c)

print(s)




'''
run:

a = 4 b = 7 c = 9

'''

 



answered Jan 31, 2022 by avibootz
0 votes
a = 4
b = 7
c = 9

# TypeError: not enough arguments for format string
# s = "a = %s b = %s c = %s" % a, b ,c

s = "a = {0} b = {1} c = {2}".format(a, b, c)

print(s)




'''
run:

a = 4 b = 7 c = 9

'''

 



answered Jan 31, 2022 by avibootz
0 votes
a = 4
b = 7
c = 9

# TypeError: not enough arguments for format string
# s = "a = %s b = %s c = %s" % a, b ,c

s = f"a = {a} b = {b} c = {c}"

print(s)




'''
run:

a = 4 b = 7 c = 9

'''

 



answered Jan 31, 2022 by avibootz

Related questions

...