Convert string to HEX characters
<p>I have the following short code:</p>

<pre><code>import socket
from sys import *

host = "10.10.10.10"
port = 7142
buf  = 1024

tcpSock = socket.socket()
tcpSock.settimeout(100)
tcpSock.connect((host,port))

## Send message
data ='\x01\x30\x41\x30\x41\x30\x36\x02\x30\x31\x44\x36\x03\x74\x0d'
if(tcpSock.send(data)):    
    print "Sending message:",data
data = tcpSock.recv(4096) 
tcpSock.close()

print "Received message:", data
#print "Received message:", data.strip().decode("hex")
</code></pre>

<p>the output been: </p>

<p><em>Sending message: ☺0A0A06☻01D6♥t</em></p>

<p><em>Received message: ☺00AB12☻0200D60000040001♥t</em></p>

<p>Where I am stuck on is how to decode the "received message" back from the server to HEX characters</p>

<p>Thanks
Alexis</p>