I have a GSM date/time stamp from a PDU encoded SMS it is formatted as so
\x90,\x21,\x51,\x91,\x40,\x33
format yy,mm,dd,hh,mm,ss
I have read them from a binary file into a byte array. I want to convert them to a string but without doing any decoding I want to end up with a string that contains 902151914033. I then need to reverse each 2 characters in the string.
Can anyone give me some pointers?
Many Thanks
To convert to hex:
hexdata = ''.join('%02x' % ord(byte) for byte in bindata)
To reverse every other hex character (if I'm understanding correctly):
hexdata = ''.join(('%02x' % ord(byte))[::-1] for byte in bindata)
convert byte array to string without interpreting the bytes?