主页
Python
Python String format() 方法
demo_ref_string_format
运行 ❯
×
更改方向
保存代码
更改主题
txt = "For only {price:.2f} dollars!" print(txt.format(price = 49))
For only 49.00 dollars!