ARTICLE AD BOX
It took me a while to get the data to this point. But I have this string array:
'00000000000000000000000000000000' '00000000000000000011111110000000' '00011100000000011111111111110000' '00011100000000111111111111111000' '00011100000001111100000001111110' '00011100000001111000000000011110' '00011100000011110000000000001111' '00011100000011100000000000000111' '00011100000011100000000000000111' '00011100000011100000000000000111' '00011100000011100000000000000111' '00011110000001110000000000001110' '00011111111111111000000000111110' '00011111111111111100000011111100' '00000001111111111100000011111000' '00000000000000111100000011100000'It's an array of 16 strings with array[0] at top. I want to convert it into a set of hex numbers, where byte0 bit15 is the bottom-left corner and byte0 bit0 is the top-left corner. So I want to wind up with: 0x0000, 0x0000, 0x0000, 0x3FFC, etc. That is, the first column above, is the first 16-bit number with the LSb at the top. I'm using Python and my brain is fried from getting it just to this point.
Here's what I have written, which does work, but I'd like to do it the Pythonic way with the inline loop.
# list2 contains the array of bits at this point list3 = [] for i in range(32): s = "" for j in range(15, -1, -1): s = s + list2[j][i] list3.append(s) # list3 has the final binary array, still need to convert to hex print(list3)