When output combines values of different types or must fit fixed columns, str.format substitutes arguments into numbered replacement fields such as {0}, {1}, and {2}. section 3.22 section 1.6
The method becomes especially useful when formatting structured output:
- Unpack a tuple into separate format arguments with format(*person). section 3.22
- Add a colon and format specification inside a field, as in {1:10}, to create a padded ten-character column. section 3.22
- Format floating-point values with controlled precision, width, alignment, and padding. section 3.22
A minimal substitution
Use 'Hello, {0}'.format('world') to place a value into a replacement field. The same task can use an f-string, but str.format remains useful when arguments are supplied separately. section 1.6
Trace tuple iteration while formatted values are prepared for aligned output. section 3.22


