@EggGump
2018-09-13T21:26:43.000000Z
字数 433
阅读 388
python
import pickle
from operator import itemgetter
data = {(1,2,3):[[1,3],[2,1],[3,0.4]],(4,5,6):[[1,3],[2,4],[3,6]]}
# with open('tmp.pk','wb') as f:
# pickle.dump(data,f)
data = 0
with open('tmp.pk','rb') as f:
data = pickle.load(f)
item = data.items()
for i in item:
triple = i[0]
entityScore = i[1]
sortresult = entityScore
print(triple)
print(sortresult)
for index in range(len(sortresult)):
tail = sortresult[index][0]
if tail == triple[1]:
print(index,sortresult[index])