title: String formatting in Python: Showing a price without decimal points
body: <p>I have a Dollar price as a <code>Decimal</code> with a precision of <code>.01</code> (to the cent.)</p>
  
  <p>I want to display it in string formatting, like having a message <code>"You have just bought an item that cost $54.12."</code></p>
  
  <p>The thing is, if the price happens to be round, I want to just show it without the cents, like <code>$54</code>.</p>
  
  <p>How can I accomplish this in Python? Note that I'm using Python 2.7, so I'd be happy to use new-style rather than old-style string formatting.</p>