Numpy Int Array to HEX and then to String Conversion PYTHON
<p>I have couple of questions </p>

<p>Say I have a numpy array </p>

<pre><code>a = np.array([0,1,2,3,4,31])

a0 = a[0]
a1 = a[1]
a2 = a[2]
a3 = a[3]
a4 = a[4]
a5 = a[5]


print hex(a4), hex(a5)
</code></pre>

<p>gives me </p>

<pre><code>   0x4L 0x1F
</code></pre>

<p>same for a0, a1, a2, a3,a5. I know the L is because of the numpy array. </p>

<p>Now how would I get 0x04 and not 0x4. </p>

<p>My required outcome is </p>

<pre><code>'0x1F0403020100'
</code></pre>

<p>My required answer should start with 0x -- the hex values of a5, a4, a3, a2, a1, a0 - without the OX. The required output is a string. I can do the bit manipulation, if I have the zero. But not without it. </p>