with open('binary.dat', 'wb') as f: f.write(b'\x10\x12\x13')