Ответ 1
Простой лучше, чем сложный.
Итак, у нас есть форматированная строка. Это дает простоту форматированию строки, сохраняя явный код (скомпонованный на другие механизмы форматирования строк).
title = 'Mr.'
name = 'Tom'
msg_count = 3
# This is explicit but complex
print('Hello {title} {name}! You have {count} messages.'.format(title=title, name=name, count=count))
# This is simple but implicit
print('Hello %s %s! You have %d messages.'%(title, name, count))
# This is both explicit and simple. PERFECT!
print(f'Hello {title} {name}! You have {msg_count} messages.')
Он предназначен для замены str.format
для простого форматирования строк.