我有以下设置:co_occurrences = defaultdict(lambda: defaultdict(int))# Populate the dictionary...for word, occurrence_vector in co_occurrences: if word == "__length": continue for file_name, occurrence_count in occurrence_vector: co_occurrences[word][file_name] = occurrence_count / co_occurrences["__length"][file_name] 这行是:co_occurrences[word][file_name] = occurrence_count / co_occurrences["__length"][file_name]危险的?危险是指我只希望一次又一次地遍历每个键,因此任何修改此行为的代码都是危险的。我感觉可能是因为我正在修改要遍历的数据结构。
添加回答
举报
0/150
提交
取消