title: How to limit digits in a logfile?
body: <p>I have a Python program that takes voltage readings and puts them into a logfile for later use. It works fine except the voltage readings have too many digits. I tried "%.5f" % in my print logfile line but I get an error "float argument required, not file". Here is the pertinent part of my program:</p>
  
  <pre><code>voltsdiff = adc.readADCDifferential01(4096, 8)
  logfile = open('logfile.txt', 'a')
  print &gt;&gt; logfile, time(), (voltsdiff-2.534)/0.03422
  logfile.close()
  </code></pre>
  
  <p>I'm getting numbers like 1052.37821133599778 and 1051.75680765443765 and I only want like 1052.</p>