Language Delimiters

! — exclamation

Introduces an explicit conversion inside an f-string replacement field, such as !r, !s or !a. It is also part of the separate != operator; Python has no standalone prefix ! negation.

Formal Syntax & Structure

python syntaxpython
!

Return Value

Not applicable

Grammar token; the enclosing construct determines any result.

Working Example

Example Snippetpython
print(f'{"hi"!r}')
Python Reference