title: Print Decimal value from long string of little endian hex values
body: <p>I am trying to read few lines of hex values from a long string of hexadecimal values then convert them into little endian and then convert that into decimal.</p>
  
  <p>Here's an example of what I am trying to do:</p>
  
  <p><a href="https://i.stack.imgur.com/7KJun.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7KJun.png" alt="LittleEndian Example"></a></p>
  
  <p>From <strong>Step 1 to Step 2</strong> I have the follow lines of code that will execute the that step:</p>
  
  <pre><code>""" Convert to Hexadecimal """
      def dump(s):
          import types
          if type(s) == types.StringType:
              return dumpString(s)
          elif type(s) == types.UnicodeType:
              return dumpUnicodeString(s)
  
      FILTER = ''.join([(len(repr(chr(x))) == 3) and chr(x) or '.' for x in range(256)])
  
      def dumpString(src, length=16):
          result = []
          for i in xrange(0, len(src), length):
             chars = src[i:i+length]
             hex = ' '.join(["%02x" % ord(x) for x in chars])
             printable = ''.join(["%s" % ((ord(x) &lt;= 127 and FILTER[ord(x)]) or '.') for x in chars])
             result.append(hex)
          return ''.join(result)
  
  """ _____________________________________________ """
  
      t = dump(TEST.encode("utf8", "replace")) #TEST is a string of characters
  </code></pre>
  
  <p>This is more or less what I have for the first jump from Step 1 to Step 2. Now from <strong>Step 2 to Step 3</strong> I was trying something along of the lines of:</p>
  
  <pre><code>newString = t[54:59]
  </code></pre>
  
  <p>However I'm unsure if the following method will work correctly when using different length of strings. It might work for the current string. So now that I have the bytes I want to focus on I am unsure of how to convert these bits into little endian in order to convert that then into decimal. Does Python have built in libraries that can aid me in converting? or using maybe a string modifier? </p>