标签: python dictionary count
这里第一次有人能告诉我如何将这个循环置于词典理解中吗?
counts = {} for word in words: if word in counts: counts[word] = counts[word] + 1 else: counts[word] = 1 print(counts)