For this program I, am getting the output twice the value. The input file is like read a file and extract the senders email address which is next to from. Display the total number of emails with count
name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
words = list()
count = dict()
for line in handle:
line = line.rstrip()
if line.startswith ('From'):
y = line.split()
print (y)
words.append(y[1])
x = y[1]
print (x)
for w in words:
count[w] = count.get(w, 0) + 1
print (count)
line = line.rstrip()result in a list or a string?