Python 3 to_bytes function shows wrong result

1.3k views Asked by At

I'm trying use the to_bytes function. In most cases it works good for me but not always. For example:

byteData = (212168254).to_bytes(4,'big')
print (byteData)

print should give me b'\x0c\xa5\x6e\x3e' but it gives me b'\x0c\xa5n>'. Why is that?

0

There are 0 answers