I really don't understand what is going on with Python.
If I use
f.write(data.encode("hex"))
Python converts my data into a hex string, so in the case of "hello" I get the string 68656c6c6f.
However using
f = open('file.dat', 'wb')
f.write("hello".encode("hex"))
f.close()
Will just write the ascii of the hex. The same is true of hexlify. I need the hex in the \00 format, yet everything seems to want to give me hex strings in ascsii