Typeerror: Unsupported Format String Passed to List._Format_

TypeError: unsupported format string passed to method.__format__

You need set value totale by call the method, write

totale=data.total_interest(time)
# ^^^^^^

instead of

data.total_interest(time)
totale=data.total_interest

and the same in second case

time = dataa.time_required(total)

instead of

dataa.time_required(total)
time=dataa.time_require

In your definition, when you call the method you get a value, when you access to the method you get the description, for example:

In [14]: data.total_interest(time)
Out[14]: 2.8000000000000003

and

In [15]: data.total_interest
Out[15]: <bound method Calculator.total_interest of <__main__.Calculator object at 0x7f3e4c575668>>

TypeError: unsupported format string passed to NoneType.__format__ with f-string in Python

You would think that using an f-string would eliminate the need for an explicit call to str, but the f-string construction gets re-routed to a call of b.__format__.

You need to ensure b is not None by calling str:

>>> f'{str(b):>11}'
' None'


Related Topics



Leave a reply



Submit