Feb-28-2020, 02:32 PM
(This post was last modified: Feb-28-2020, 02:59 PM by adetheheat.)
I have a csv row like this:
I need to create a stream of bytes from it of size 16 bit -
So I want the above portion of the array to end up being an array like this:
One part will be to do a join based on ','. After that use bytearray ??? But I'm not sure.
Thanks for any help.
I worked out the solution:
1,5,14343,3456,6123,34002,4etc
I need to create a stream of bytes from it of size 16 bit -
So I want the above portion of the array to end up being an array like this:
0x0001,0x0005,0x3807,0x0D80,0x17EB,0x84D2,0x0004This will get loaded into memory in my C program.
One part will be to do a join based on ','. After that use bytearray ??? But I'm not sure.
Thanks for any help.
I worked out the solution:
newArray = ''.join('{:04x}'.format(x) for x in myArray)