name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
counts=dict()
bigword=None
bigcount=None
for line in handle:
if line.startswith('From:'):continue
if line.startswith('From '):
line=line.rstrip()
x=line.split('From ')
y=x[1]
z=y.split()
d=z[0]
print(z[0])
ın the text there were many things and whit that it takes only user names such as 'sinemucari@gmail.com' now I want to take all this names there were like 30 names. and put them in to dictionary and count how much they were repeated and what is the most repeated one.
for user in z[0]:
counts[user]=counts.get(user,0)+1
print(counts)
for user,count in counts.items():
if bigcount is None or count>bigcount:
bigword=user
bigcount=count
print(bigcount,bigword)