Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
File size: 1,184 Bytes
6b4490e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import struct


def getLen(_f):
    _data = _f.read(1)
    _a_l = _l = _data[0]
    while _l == 255:
        _data = _f.read(1)
        _l = _data[0]
        _a_l += _l
    return _a_l


# with open('E:\\tmp\\ISLAND\\cst\\lin03_selA_ret.cstl', 'rb') as f:
#     data = f.read(8)
#     Header = struct.unpack_from('4sI', data)
#     print(Header)
#     al_len = getLen(f)
#     for i in range(al_len):
#         data = f.read(getLen(f))
#         print(data)
#     al_len = getLen(f) * al_len * 2
#     print('len', al_len)
#     while al_len > 0:
#         data = f.read(getLen(f))
#         print(data.decode('utf-8'))
#         al_len -= 1


def getTxt(path):
    retn = []
    with open(path, 'rb') as f:
        data = f.read(8)
        Header = struct.unpack_from('4sI', data)
        print(Header)
        al_len = getLen(f)
        for i in range(al_len):
            data = f.read(getLen(f))
            print('语言', data)
        al_len = getLen(f) * al_len * 2
        print('数量', al_len)
        while al_len > 0:
            data = f.read(getLen(f))
            retn.append(data.decode('utf-8'))
            al_len -= 1
        assert not f.read(1)
    return retn