I'm using Python 3.6. I have a need to convert several small integers into single bytes. As far as I can tell from reading through the Python docs, the correct way to accomplish this task is:
b = i.to_bytes(1, "big") This seems to work, but I find it cumbersome. I have to supply the byteorder argument to prevent a TypeError. However, byte order doesn't matter if I'm only generating a single byte. Whether I choose "big" or "little" I should get the same result. Is there another function which provides a more logical interface to this straightforward task? Thanks for any suggestions. -- https://mail.python.org/mailman/listinfo/python-list