title: Dictionary to count the email-address from the maillog file python
body: <p>Experts, I am trying to count the E-maill address and number of their repitions in the maillog file which somehow i am able to make using Regular expression (re.search) OR (re.match) but i am looking this to be accomplished with (re.findall) which currently i am dabbling with.. would appreciate any suggestions..</p>
  
  <p>1) Code Line ...</p>
  
  <pre><code># cat maillcount31.py
  #!/usr/bin/python
  import re
  #count = 0
  mydic = {}
  counts = mydic
  fmt = " %-32s %-15s"
  log =  open('kkmail', 'r')
  
  for line in log.readlines():
          myre = re.search('.*from=&lt;(.*)&gt;,\ssize', line)
          if myre:
             name = myre.group(1)
             if name not in mydic.keys():
                mydic[name] = 0
             mydic[name] +=1
  
  for key in counts:
     print  fmt % (key, counts[key])
  
  2) Output from the Current code..
  
  # python maillcount31.py
   root@MyServer1.myinc.com         13
   User01@MyServer1.myinc.com       14
  </code></pre>