Advertisement
igort91

analisis mail

Nov 28th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. def obtener_dominios(correos):
  2.     lista_dom=[]
  3.     for j in correos:
  4.         _,dom=j.split("@")
  5.         lista_dom.append(dom)
  6.     return sorted(list(set(lista_dom)))
  7.  
  8. c = ['fulano@usm.cl', 'erika@lala.de', 'li@zi.cn', 'a@a.net',
  9.      'gudrun@lala.de', 'otto.von.d@lorem.ipsum.de', 'org@cn.de.cl',
  10.   'yayita@abc.cl', 'jozin@baz.cz', 'jp@foo.cl', 'dawei@hao.cn',
  11.      'pepe@gmail.com', 'ana@usm.cl', 'polo@hotmail.com', 'fer@x.com',
  12.      'ada@alumnos.usm.cl', 'dj@foo.cl', 'jan@baz.cz', 'd@abc.cl']
  13.  
  14. def contar_tld(correos):
  15.     lista_tld=[]
  16.     dicc=dict()
  17.     for j in correos:
  18.         a=j.split(".")[-1]
  19.         lista_tld.append(a)
  20.         dicc[a]=lista_tld.count(a)
  21.     return dicc
  22.  
  23. print contar_tld(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement