Shortest way to convert these bytes to int in python?
<p>I'm converting the following string to it's unsigned integer representation:</p>

<p><code>str = '\x00\x00\x00\x00\x00\x00\x01\xFF'</code></p>

<p>I can use <code>struct.unpack('8B', str)</code> to get the tuple representation <code>(0,0,0,0,0,0,1,255)</code>, but what's the quickest/easiest way to convert this tuple to an int?</p>

<p>Right now, my code is</p>

<pre><code>def unpack_str(s):
  i = r = 0
  for b in reversed(struct.unpack('8B', s)):
    r += r*2**i
    i++
  return r
</code></pre>

<p>But this is long and ugly, for such a simple function! There must be a better way! Can any SO python gurus help me to trim this down and python-ify it?</p>
