title: How to retain leading zeros of int variables?
body: <p>Below is a section of code which is part of a functional decryption and encryption program.</p>
  <pre><code>while checkvar &lt; maxvar: # is set to &lt; as maxvar is 1 to high for the index of var
      #output.append(&quot;%02d&quot; % number)
      i =ord(var[checkvar]) - 64 # Gets postional value of i
      i = (&quot;%02d&quot; % i)
      if (checkvar + 1) &lt; maxvar:
          j =ord(var[(checkvar + 1)]) - 64 # Gets postional value of i
          j = (&quot;%02d&quot; % j)
          i = str(i) + str(j) #'Adds' the string i and j to create a new i
      li.append(int(i))
      checkvar = checkvar + 2
  
  print li
  </code></pre>
  <p>As you can see the two variables i and j are first treated as string to add a 0 in front of any single digit numbers (as string). These variables then are combined to make a four digit number (still as a string). Later in the program the number created are used in a <code>pow()</code> function, as <code>int</code>s remove any leading zeros.</p>
  <p>My question: Is it possible to force python to keep the leading zero for <code>int</code>s? I have and continued to search online.</p>
  <p><strong>Edit</strong></p>
  <p>To help people I have included the encryption part of the program. This is where the problem lies. The variables created in the above code are passed through a <code>pow()</code> function. As this can't handle strings I have to convert the variables to <code>int</code>s where the leading zero is lost.</p>
  <pre><code>#a = li[]
  b=int(17)#pulic = e
  c=int(2773)#=n
  
  lenli=int(len(li))
  enchecker = int(0)
  
  #encrpted list
  enlist = []
  
  while enchecker &lt; lenli:
      en = pow(li[enchecker],b,c)#encrpyt the message can only handle int
      enlist.append(int(en))
      enchecker = enchecker + 1
  
  print enlist
  </code></pre>