title: Using python to write hex to file
body: <p>I am trying to create a bunch of binary files that contain corresponding hex values</p>
  
  <pre><code>for i in range(2**8):
      file = open("test" + str(i) + ".bin", "wb")
      file.write(hex(i))
      file.close()
  </code></pre>
  
  <p>Unfortunately it appears that a text representation of my counter converted to hex is being written to the files instead of the actual hex values.  Can someone please correct this code?  I'm sure the problem is with <code>hex(i)</code></p>