title: How to encode decimal lines to hex?
body: <p>When i try this</p>
  <pre><code>f = open('j:/out.txt', 'r')
  lines = []
  for line in f:
      lines.append(line)
      f1 = open('j:/out1.txt', 'a')
      print (''.join(hex(int(c)) for c in line.strip('\n')))
      f1.write(''.join(hex(int(c)) for c in line.strip('\n')) + &quot;\n&quot;)
      f1.close()
      print (line.strip('\n'))
  </code></pre>
  <p>it's encode return  some decimals strings not heximal , how make it correct for it return heximal value from dec ?</p>
  <p>input data is only decimal lines.</p>
  <p>answer</p>
  <pre><code>f = open('j:/out.txt', 'r')
  lines = []
  for line in f:
      lines.append(line)
      f1 = open('j:/out1.txt', 'a')
      for c in line.strip('\n').split():
          dec = c
          decimal = int(dec);
          inHexadecimal = hex(decimal);
          print (inHexadecimal.strip('0x'));
          f1 = open('j:/out1.txt', 'a')
          f1.write(inHexadecimal.strip('0x') + &quot;\n&quot;)
          f1.close()
      print (line.strip('\n'))
  </code></pre>