Sahaj.blogs

Day page

21 Aug 2023

Study

Python · Strings: f-strings and formatting

f-strings, the format mini-language (width, precision, alignment, thousands separators) and the = debugging shortcut.

  • Everything after the colon in {value:spec} is the format spec: width, alignment, precision, type.
  • f"{x=}" prints both the expression and its value, which is handy for debugging.

Read the post →