You can just build a bytes object with that value:
with open('my_file', 'wb') as f:
f.write(bytes([10]))
This works only in python3. If you replace bytes with bytearray it works in both python2 and 3.
Also: remember to open the file in binary mode to write bytes to it.