How to convert "ASCII" to "hex" in python
<p>How to convert "ASCII" to "HEX" in python</p>

<p>I have one file need to read . but use below code it only can show ASCII</p>

<pre><code>with open('Hello.DAT','rb') as f:
    data= f.read()  
    print(data)
</code></pre>

<p>It can print data in this format:</p>

<blockquote>
  <p>01201602180000020000000007000000000054000000000000\x0</p>
</blockquote>

<p>How do I to convert this data to HEX values, like  this: </p>

<blockquote>
  <p>30 31 32 30 31 36 30 32 31 38 30 30 30 30 30 32 30 30 30 30 30 30 30
  30 30 37 30 30 30 30 30 30 30 30 30 30 35 34 30 30 30 30 30 30 30 30
  30 30 30 30 5c 78 30</p>
</blockquote>