title: Using python string formatting in a django template
body: <p>Is there an easy way to use python string formatting from within a django template?  That is, I'd like to be able to do something like this in a template</p>
  
  <pre><code>{{ variable|%.3f }}
  </code></pre>
  
  <p>I know in this case, one can just use</p>
  
  <pre><code>{{ variable|floatformat:3 }}
  </code></pre>
  
  <p>But I'd really like to be able to generically use any python string format on a django variable.  In my system it's inconvenient to have to deal with two different ways to format output (python vs django), so I'd like to standardize.  I could write a custom template tag like</p>
  
  <pre><code>{% pyformat variable format="%.3f" %}
  </code></pre>
  
  <p>or maybe a custom template filter like</p>
  
  <pre><code>{{ variable|pyformat:"%.3f" }}
  </code></pre>
  
  <p>Do either of these already exist?  Will the customer filter work with a string passed in like that?</p>