+ 5
Consider the input file 'mbox.txt', extract the email-ids that belong to the lines starting with 'From'.
Consider the input file 'mbox.txt', extract the email-ids that belong to the lines starting with 'From'. Display all the email-ids, also tell which is the most popular mail-id.write a python code for this ? mbox.txt file contains lots of mails,extract email-ids
5 odpowiedzi
+ 3
/*consider mbox.txt file ,extracts email-id's that start with 'From' & display the email ids that are most popular in descending order of their frequency.
write a python code for this??*/
fh=open('mbox.txt')
words=[]
list=[]
d=[]
for line in fh:
if line.startwith('From'):
words=line.split()
list.append(words[1])
for c in list:
if c not in d:
d[c]=1
else:
d[c]+=1
c=0
for key in sorted(d,key=d.get,reserve=True):
if c<=10:
print(key,':',d[key])
c+=1
else:
break
@muhammad kamal
+ 2
seriously I dunno if that's help or challenge 😭
+ 2
its a challenge @muhammad kamal
+ 1
Whats the edit:fail.xd??@muhammad kamal
0
EDIT: Fail. xd