Is there a more efficient method to convert an integer, in the range 0..255 (in C uint8), to one byte?
x = 100
x.to_bytes(1, "big")


python3, converting integer to bytes: which are the alternatives to using to_bytes() for small integers?
More efficient method for a single integer? Probably not.
Here's a comparison of the common ones:
python -m timeit -s "import struct" "struct.pack('<B', 100)"
2000000 loops, best of 5: 101 nsec per loop
python -m timeit "(100).to_bytes(1)"                     
5000000 loops, best of 5: 81.1 nsec per loop
python -m timeit "bytes([100])"     
2000000 loops, best of 5: 199 nsec per loop

If you're talking about multiple, bytes([integers]) will probably be the most efficient.
For some premature optimization you can cache the function, which will net you a few nanoseconds:
python -m timeit -s "tb = int.to_bytes" "tb(100,1)" 
5000000 loops, best of 5: 78.6 nsec per loop

And if you want the most efficient possible, it would probably be using a tuple:
python -m timeit -s "b=tuple(map(int.to_bytes, range(256)))" "b[100]"
10000000 loops, best of 5: 20.9 nsec per loop

But personally I find it disgusting.
