<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Friedrich:<br>
    <br>
    <snip><br>
    <br>
    <blockquote cite="mid:%3Cism61s$grp$1@speranza.aioe.org%3E"
      type="cite">
      <blockquote type="cite">
        <pre wrap="">
I would be much obliged if someone can give me some tips on how to
achieve a variably pad a number.
</pre>
      </blockquote>
      <pre wrap="">
:)

('%%0%dd' % (pads,)) % (n,)

Probably be good to wrap it in a function.  It looks kind of obscure as it 
is.
</pre>
    </blockquote>
    <br>
    You might want to try "new style" string formatting [1], which I
    think is better than the "old style" in this particular case:<br>
    <blockquote><tt>>>> "Testing {0:0{1}d}".format(42, 4)</tt><br>
      <tt>'Testing 0042'</tt><br>
      <tt>>>> "Testing {0:0{1}d}".format(42, 9)</tt><br>
      <tt>'Testing 000000042'</tt><br>
    </blockquote>
    <br>
    <br>
    HTH,<br>
    John<br>
    <br>
    [1] <a class="moz-txt-link-freetext" href="http://docs.python.org/library/string.html">http://docs.python.org/library/string.html</a>, Section 7.1.2
    "String Formatting"<br>
    <br>
  </body>
</html>