title: Best way to format integer as string with leading zeros?
body: <p>I need to add leading zeros to integer to make a string with defined quantity of digits ($cnt).
  What the best way to translate this simple function from PHP to Python:</p>
  
  <pre><code>function add_nulls($int, $cnt=2) {
      $int = intval($int);
      for($i=0; $i&lt;($cnt-strlen($int)); $i++)
          $nulls .= '0';
      return $nulls.$int;
  }
  </code></pre>
  
  <p>Is there a function that can do this?</p>