I create a byte string and save it to a file via the following Python code:
bytes = b'1234567890'
file = open("bytes.txt", "wb")
file.write(bytes)
Then I open the file via "hexdump" and expect to see the bytes in the same sequence
as they were in the byte string, i.e.
3132 3334 3536 3738 3930
But the result is:
> hexdump bytes.txt
0000000 3231 3433 3635 3837 3039
000000a
The bytes are swapped with each other, i.e. 1st with the 2nd, 3rd with the 4th and etc.
Why is the byte string saved in this swapped format?
And how to make Python save bytes to the file in exactly the same way as they are in the string?
Thank you.