代码示例:(标识:python_string_formatting_1)
python_string_formatting_1.py
price = 52
txt = "The price is {} dollars"
print(txt.format(price))
运行结果: