برای این عمل از دستور فرمت استفاده می گردد

quantity = 3
itemno = 567
price = 49.95
myorder = "I want to pay {2} dollars for {0} pieces of item {1}."
print(myorder.format(quantity, itemno, price))

-------------------چاپ--------------------

I want to pay 49.95 dollars for 3 pieces of item 567.