Formatting string — .format() method

DevTechie
DevTechie
Published in
6 min readMay 16, 2024

--

Formatting string — .format() method

Before Python 3.6, there were two basic tools for interpolating (mixing) values, variables, and expressions within string literals:

1 — The string interpolation operator (%) (the math’s modulo operator)

2 — The string.format() method

This article talks about the second one — format() of string (str) class for string formatting.

--

--