# A Guide to Modern Python String Formatting Tools

DevFeed: [A Guide to Modern Python String Formatting Tools](<https://devfeed.tech/articles/a-guide-to-modern-python-string-formatting-tools-98859.md>)

Original publisher: [Read original article](<https://realpython.com/python-formatted-output/>)

Author: Leodanis Pozo Ramos

Published: 2026-10-24T14:00:00Z

Content type: tutorial

Language: en

Sources: [Real Python](<https://devfeed.tech/sources/real-python.md>)

Topics: [formatting](<https://devfeed.tech/topics/formatting.md>), [Python](<https://devfeed.tech/topics/python.md>), [Learning](<https://devfeed.tech/topics/learning.md>)

Tags: [align](<https://devfeed.tech/tags/align.md>), [alignment](<https://devfeed.tech/tags/alignment.md>), [argument](<https://devfeed.tech/tags/argument.md>), [arguments](<https://devfeed.tech/tags/arguments.md>), [arithmetic](<https://devfeed.tech/tags/arithmetic.md>), [automatic](<https://devfeed.tech/tags/automatic.md>), [base](<https://devfeed.tech/tags/base.md>), [bnf](<https://devfeed.tech/tags/bnf.md>), [boolean](<https://devfeed.tech/tags/boolean.md>), [built-in](<https://devfeed.tech/tags/built-in.md>), [class](<https://devfeed.tech/tags/class.md>), [component](<https://devfeed.tech/tags/component.md>), [f](<https://devfeed.tech/tags/f.md>), [format](<https://devfeed.tech/tags/format.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [modern](<https://devfeed.tech/tags/modern.md>), [python](<https://devfeed.tech/tags/python.md>), [string](<https://devfeed.tech/tags/string.md>), [strings](<https://devfeed.tech/tags/strings.md>), [tools](<https://devfeed.tech/tags/tools.md>)

## AI overview

The excerpt recommends f-strings for quick string formatting in modern Python: prefix a string with `f` or `F` and put variables or expressions in curly-brace fields. Values are interpolated when the f-string runs, so referenced names must already be defined. The `.format()` method fills fields in a template from positional or named arguments, which the excerpt identifies as useful for older Python versions or legacy code. Its positional fields may be numbered or automatically sequenced, but those numbering styles cannot be mixed; missing fields or arguments can raise errors. Both tools support conversions such as `!s` and `!r` and format specifications for type, width, alignment, fill, sign, precision, and digit grouping. The excerpt also notes that Python 3.12 expanded f-string expression capabilities and that Python 3.14 adds t-strings, which produce objects for custom processing rather than finished formatted strings.

## Source excerpt

Explore Python's modern string formatting tools, and learn to harness f-strings and the .format() method for interpolation and formatting.