我正在做一项练习,给定一个CSV文件(其中显示了前三行),我需要编写一个程序来计算每个发送者的消息数量,然后按照发送者的字母顺序打印输出结果。
发送者,消息
"hello there!"
"Computing is damn hard!"
这是我到目前为止尝试过的:
from collections import defaultdict
import csv
counting = defaultdict(int)
for row in csv.reader(open(message.csv)):
counting[row[0]] += 1
我卡在如何继续的地方。