Skip to content
Discussion options

You must be logged in to vote

@A622266 Yep that's right, this is standard Python behavior -- bytes and bytearrays are printed as strings, where only the "unprintables" are escaped.

I would recommend instead making your tool print out the same format as Python prints

i.e.

program = b'\x00\x00\x00\x00\x00\xfe\xe0\x00....'

This has the added benefit of using less memory when loading your program, as the initial consutrction of the list uses 4x as much RAM (because the bytes will be promoted to integers, only to be truncated back down to bytes when creating the bytearray).

If you want to verify the data use

print(program.hex(','))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by A622266
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants