title: How to round a number to significant figures in Python
body: <p>I need to round a float to be displayed in a UI.  e.g, to one significant figure:</p>
  <pre><code>1234 -&gt; 1000
  
  0.12 -&gt; 0.1
  
  0.012 -&gt; 0.01
  
  0.062 -&gt; 0.06
  
  6253 -&gt; 6000
  
  1999 -&gt; 2000
  </code></pre>
  <p>Is there a nice way to do this using the Python library, or do I have to write it myself?</p>