String Formatting

Learn how Python's f-strings enable dynamic string formatting by interpolating variables and expressions into template text.

We'll cover the following...

Overview

Python 3 has powerful string formatting and templating mechanisms that allow us to construct strings comprised of template text and interspersed representations of objects usually from variables, but also from expressions. We’ve used it in many previous examples, but it is much more versatile than the simple formatting specifiers we’ve used. ...