[issue36774] f-strings: Add a !d conversion for ease of debugging
Eric V. Smith
report at bugs.python.org
Sat May 4 07:52:52 EDT 2019
Eric V. Smith <eric at trueblade.com> added the comment:
And for those who *really* want to be able to apply a format spec to the result of the entire !d expression, you can always use nested f-strings:
>>> for x in [3.1415, 0.5772156649, 100]:
... print(f'{f"{x!d:.1f}":*^20}')
...
*******x=3.1********
*******x=0.6********
******x=100.0*******
Not that I recommend this, but at least it's possible.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36774>
_______________________________________
More information about the Python-bugs-list
mailing list