title: How to specify floating point decimal precision from variable?
body: <p>I have the following repetitive simple code repeated several times that I would like to make a function for:</p>
  
  <pre><code>for i in range(10):
      id  = "some id string looked up in dict"
      val = 63.4568900932840928 # some floating point number in dict corresponding to "id"
      tabStr += '%-15s = %6.1f\n' % (id,val)
  </code></pre>
  
  <p>I want to be able to call this function: <code>def printStr(precision)</code><br>
  Where it preforms the code above and returns <code>tabStr</code> with <code>val</code> to <code>precision</code> decimal points.  </p>
  
  <p>For example: <code>printStr(3)</code><br>
  would return <code>63.457</code> for <code>val</code> in <code>tabStr</code>.</p>
  
  <p>Any ideas how to accomplish this kind of functionality?</p>