I have a list of floats that I would like to print using an f-string: Here is the list
er=[0.3401126304419511,
0.32561695086083536,
0.3115512789515306,
0.21734184387097139,
0.22354269408531188]
and I want to print them using an f-string as follows:
print(f'{err}')
which produces:
[0.3401126304419511, 0.32561695086083536, 0.3115512789515306, 0.21734184387097139, 0.22354269408531188]
But the following doesn't work:
print(f'{err:.2}')
Traceback (most recent call last):
File "C:\IPython\core\interactiveshell.py", line 3325, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-166-bbcdc82a9939>", line 1, in <module>
print(f'{err:.2}')
TypeError: unsupported format string passed to list.__format__
Is this a bug or a feature? How do I make this work?
I'm using python version:
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32