When messing around in python with the exclamation mark, it said that it has to be followed by either !a
, !s
, or !r
.
What does !a
do?
Like can you do this?
f"{"txt"!a}"
What will be the result?
"TXT" # Obviously not this, but still
Found the answer to my question in the accepted answer for this question:
!r
(repr
),!s
(str
) and!a
(ascii
) were kept around just to ease compatibility with thestr.format
alternative, you don't need to use them with f-strings.