主页
Python
Python 字符串格式化
demo_string_formatting4
运行 ❯
×
更改方向
保存代码
更改主题
quantity = 3 itemno = 567 price = 49 myorder = "I want {0} pieces of item number {1} for {2:.2f} dollars." print(myorder.format(quantity, itemno, price))
I want 3 pieces of item number 567 for 49.00 dollars.