title: How do I format a number with a variable number of digits in Python?
body: <p>Say I wanted to display the number 123 with a variable number of padded zeroes on the front.</p>
  <p>For example, if I wanted to display it in 5 digits I would have <code>digits = 5</code> giving me:</p>
  <pre><code>00123
  </code></pre>
  <p>If I wanted to display it in 6 digits I would have <code>digits = 6</code> giving:</p>
  <pre><code>000123
  </code></pre>
  <p>How would I do this in Python?</p>