理解f in Python

  • Literal String Interpolation

“f-string”, the expressions are evaluted at runtime and then formatted using the __format__ protocol.

Much more information could be found in Python docs.

  • References

  1. Python 3’s f-Strings: An Improved String Formatting Syntax (Guide)
  2. PEP 498 – Literal String Interpolation

你可能感兴趣的:(#,小白学Python)