DEV Community

[Comment from a deleted post]
Collapse
 
fernandosavio profile image
Fernando Sávio

Vou deixar comentado aqui pra facilitar:

Na documentação da linguagem de formatação tem um trecho onde diz:

If a conversion is specified, the result of evaluating the expression is converted before formatting. Conversion '!s' calls str() on the result, '!r' calls repr(), and '!a' calls ascii().

Que basicamente diz que:

  1. f"{variavel!r} == repr(variavel) (#docs)
  2. f"{variavel!s} == str(variavel) (#docs)
  3. f"{variavel!a} == ascii(variavel) (#docs)

Qualquer dúvida o site PyFormat tem bastante coisa legal.

 
danielle8farias profile image
ダニエリ

Obrigada!