Migrating code to Python3.6, unpacking and assigning to a list worked in Python2.6 as the whole list was a string, in 3.6 string values are represented as bytecode. Any value that was an integer is being represented correctly in the list, but any string fields are being represented as bytes still eg: b'B'
Source data is a binary file containing various messages, with various lengths, these messages are successfully being unpacked and stored in a list
Raw byte values data of a sample message
b'\x07\x88g\xe0b\xe5]\xc5\x00\x01j\xdd\x00\x01\xff\xdcB\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x03\xe8\x00\x00\x02'
Unpacked data - using '>I Q I c I Q i H B' on the raw byte values above
[126380000, 7126205086073711325, 131036, b'B', 1, 10, 1000, 0, 2]
End state: to implement a generic solution that will detect any b' in a list (can be any index in a list depending on message) convert to a normal string value.
or do not store string values as bytecode during the unpack
Current : [126380000, 7126205086073711325, 131036, b'B', 1, 10, 1000, 0, 2]
End state: [126380000, 7126205086073711325, 131036, B, 1, 10, 1000, 0, 2]
Noting b'B' is to be simply represented as B
I have searched google and stackoverflow for a answer, but only find generic decode examples.
Thanks in advance