
Хочу составить словарь из двухмерного списка, где в тексте каждое предложение в отдельном массиве.
counts = dict() for line in new: for word in line: if word not in counts: counts[word] = 1 else: counts[word] += 1 print counts
Выдает ошибку
TypeError Traceback (most recent call last) <ipython-input-57-e4f381b50f11> in <module>() ----> 1 counts = dict() 2 for line in new: 3 for word in line: 4 if word not in counts: 5 counts[word] = 1 TypeError: 'dict' object is not callable
1 Ответы
