次の 3 つの整数値があります。
id # identifies the pair
entropy # gives entropy information
len # basicly the length of a string
ここで、これらの値の多くを保存し、全体のエントロピーが最も高く、長さの値が 10 を超える上位 10 個を選択します。n
from collections import defaultdict
d = defaultdict(list)
for id, entropy, len in generateValues:
d[id].append(entropy)
d[id].append(len)
# now get the top 10 values
これは簡単にできますか?