Skip to content

Glossary: Python Basics

Format code

Also written: format codes, .2f

A short code after a colon inside an f-string's braces that controls how a value is shown. `.2f` gives two decimal places, and `:<12` and `:>8` pad and align text.

Where the book teaches it

Related terms

f-string