def get_score(s):
    return struct.unpack('>d', ('\x00\x01' + (
        '\x00\x00\x00\x00\x00\x00\x00\x00' + s[:6])[-6:]).encode('ascii',
        'error'))[0]
How to compute a double precision float score from the first 8 bytes of a string in Python?