Hex converter help - Python
<p>I have this code that converts binary to hex</p>

<pre><code>##  The Input part

l = raw_input('Input 8-bit number: ')
j = list(l)

##  Value Error part

t = [int(x) for x in j]
if len(t) != 8 or len([n for n in t if n not in (1, 0)]) != 0:
  raise ValueError('NOT 1 OR 0, or NOT CORRECT LENGTH')


##  The Conversion part

a = l[0]
b = l[1]
c = l[2]
d = l[3]
e = l[4]
f = l[5]
g = l[6]
h = l[7]

p = a+b+c+d
q = e+f+g+h

y = hex(int(p, 2))[2:]
z = hex(int(q, 2))[2:]

##  The Results part

print
print 'Results'
print 'Binary: ',l
print 'Hex: ',y+z
</code></pre>

<p>my whole conversion part is insanely long because whenever i try to convert a number that has 0000 in front of it it doesnt print the 0 and i need it to print the 0 is there a way to do this without doing the long process</p>
