Python str.format() Method
The format() method formats the specified value(s) and insert them
inside the string's placeholder.
The placeholder is defined using curly brackets: {}.
Syntax
string.format(value1, value2...)
Parameters
| Parameter | Description |
|---|---|
values |
Required. The values to format |
Return Value
A formatted string.
Example
Using the format() method:
Output
Click Run to execute your code
Enjoying these tutorials?