
A Python value x in an f-string’s {} normally interpolates str(x), aka x.__str__.
Want the repr instead, aka x.__repr__? Put !r after the value:
f'{x}’ # returns str(x)
f'{x!s}’ # also returns str(x), but unneeded
f'{x!r}’ # returns the repr

A Python value x in an f-string’s {} normally interpolates str(x), aka x.__str__.
Want the repr instead, aka x.__repr__? Put !r after the value:
f'{x}’ # returns str(x)
f'{x!s}’ # also returns str(x), but unneeded
f'{x!r}’ # returns the repr