I have a function converting integers to bytes and ran into the following issue.
When using the code below.
>>> data = 9
>>> print(data.to_bytes())
I get this :
>>> b'\t'
When I should be getting this:
b'\x09'
Can anyone say this is happening?
If you want the hex value, you can use an f-string:
If you want a hex dump, you can try:
Here is a version that shows a hex dump for an encoded message:
Output: