title: Python 3.3 binary to hex function
body: <pre><code>def bintohex(path):
      hexvalue = []
      file = open(path,'rb')
      while True:
          buffhex = pkmfile.read(16)
          bufflen = len(buffhex)
          if bufflen == 0: break
          for i in range(bufflen):
              hexvalue.append("%02X" % (ord(buffhex[i])))
  </code></pre>
  
  <p>I am making a function that will return a list of hex values of a specific file. However, this function doesn't work properly in Python 3.3. How should I modify this code?</p>
  
  <pre><code>File "D:\pkmfile_web\pkmtohex.py", line 12, in bintohex hexvalue.append("%02X" % (ord(buffhex[i]))) TypeError: ord() expected string of length 1, but int found
  </code></pre>