with?open('mail.txt',?'r')?as?f:
for?line?in?f:
if?line?==?'\n':
continue
word?=?line.split()
if?word[0]?==?'From':
if?word[1]?in?d:
d[word[1]]?+=?1
else:
d[word[1]]?=?1
maxf?=?list(d.keys())[0]
for?k?in?d:
if?d[k]?>?d[maxf]:
maxf?=?k
print(maxf,?d[maxf])
我用Python3,不過在字典添加東西的語法壹樣
dict['key'] = 123
值加壹的語法
dict['key'] = dict['key'] + 1
或者
dict['key'] += 1