I am trying to convert an integer to hex. I have found answers that address this problem like this, though they do not work for me. What i mean:
if i take this:
buf = ""
buf += "\xda\xc7\xd9\x74\x24\xf4\xbe\x9d\xca\x88\xfb\x5a\x29"
print buf
and i run it from console with python myfile.py then the output is something like this: ���t$���ʈ�Z), which is what i want (the output has been read as hex). If though i try this:
var1 = 230
var2 = ""
var2 = "\\" + "x" + "%0.2X" % var1
print var2
the output is \xE6, not read as hex by the console. What am i missing here??