How to convert HEX data into BINARY data?
<p>I am trying to send Binary data using python raw socket.
For that i will do following.</p>

<pre><code>s = '\x01\x00\x12\x59' # some binary data
sock.send(s)           # assuming "sock" is a valid, open socket object
</code></pre>

<p>i have created a DATAGRAM in HEX in by sniffing a network traffic with wireshark.Which i want to send over the network.This hand made datagram is like </p>

<p>"04 f8 00 50 4f 30  fb 47 28 62 a7 6d 50 02 02 00 d2 7f 00 00"</p>

<p>So i wanna convert this above mentioned HEX datagram into the binary format like "\x01\x00\x12\x59".
How can i do that?</p>
