title: Convert a IP to Hex by Python
body: <p>I am writing a script to convert a IP to HEX. Below is my script:</p>
  
  <pre><code>import string
  ip = raw_input('Enter IP')
  a = ip.split('.')
  b = hex(int(a[0])) + hex(int(a[1])) + hex(int(a[2])) + hex(int(a[3]))
  b = b.replace('0x', '')
  b = b.upper()
  print b
  </code></pre>
  
  <p>My Problem is that for IP like 115.255.8.97, I am getting this:</p>
  
  <p>Answer Coming : 73FF861</p>
  
  <p>Expected Ans :  73FF0861</p>
  
  <p>Can anyone is clever enough to tell me what mistake I am making.</p>