close

[Solved] TypeError: unsupported format string passed to list.__format__

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: unsupported format string passed to list.format 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 TypeError: unsupported format string passed to list. format Error Occurs?

Today I get the following error TypeError: unsupported format string passed to list.format in python.

How To Solve TypeError: unsupported format string passed to list. format Error ?

  1. How To Solve TypeError: unsupported format string passed to list. format Error ?

    To Solve TypeError: unsupported format string passed to list. format Error You can pass a list type to format (using just {}), but the formatting you requested isn't available. And the standard formatting isn't suited anyway, so…

  2. TypeError: unsupported format string passed to list.format

    To Solve TypeError: unsupported format string passed to list. format Error You can pass a list type to format (using just {}), but the formatting you requested isn't available. And the standard formatting isn't suited anyway, so…

Solution 1

You can pass a list type to format (using just {}), but the formatting you requested isn’t available. And the standard formatting isn’t suited anyway, so…

What you want is each list on one separate column. You’ll have to zip lists together, and iterate on the result to pass it to format:

results = [1,2,3,4]
p_results = [5,6,7,8]

for result,p_result in zip(results,p_results):
    print('{:3}{:20}'.format(result,p_result))

That prints something like:

  1                   5
  2                   6
  3                   7
  4                   8

Solution 2

One trick is to solve this:

'{:15}'.format('{}'.format([1,2,3]))

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