I have couple of questions
Say I have a numpy array
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)
gives me
0x4L 0x1F
same for a0, a1, a2, a3,a5. I know the L is because of the numpy array.
Now how would I get 0x04 and not 0x4.
My required outcome is
'0x1F0403020100'
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.
0x0403020100
supposed to be hex for your entire array? That most certainly doesn't work like that... That number is 17230332160... And0x4
,0x04
,0x000004
are all the same number: 4 (in both hexadecimal end decimal). You might be facing an XY problem.0x
? I'm pretty sure you don't need that. I mean, it's as if you wanted to represent your array in decimal as43210
.