title: How to use hex() without 0x in Python?
body: <p>The <code>hex()</code> function in python, puts the leading characters <code>0x</code> in front of the number. Is there anyway to tell it NOT to put them? So <code>0xfa230</code> will be <code>fa230</code>.</p>
  
  <p>The code is</p>
  
  <pre><code>import fileinput
  f = open('hexa', 'w')
  for line in fileinput.input(['pattern0.txt']):
     f.write(hex(int(line)))
     f.write('\n')
  </code></pre>