title: Counting number of unique items from a dictionary
body: <p>My program reads in a large log file. It then searches the file for the IP and TIME(whatever is in the brackets).</p>
  
  <p>5.63.145.71 - - [30/Jun/2013:08:04:46 -0500] "HEAD / HTTP/1.1" 200 - "-" "checks.panopta.com"
  5.63.145.71 - - [30/Jun/2013:08:04:49 -0500] "HEAD / HTTP/1.1" 200 - "-" "checks.panopta.com"
  5.63.145.71 - - [30/Jun/2013:08:04:51 -0500] "HEAD / HTTP/1.1" 200 - "-" "checks.panopta.com"</p>
  
  <p>I want to read the whole file, and summarize the entries as follows:</p>
  
  <p>Num 3 IP 5.63.145.1 TIME [30/Jun/2013:08:04:46 -0500]  Number of entries, IP, TIME and DATE</p>
  
  <p>What I have so far:</p>
  
  <pre><code>import re
  
  
  x = open("logssss.txt")
  
  dic={}
  
  
  for line in x:
      m = re.search(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b",line).group().split()
      c = re.search(r"\[(.+)\]",line).group().split()
      for i in range(len(m)):
          try:
              dic[m[i]] += 1 
          except:
              dic[m[i]] = 1
          k = dic.keys()
  for i in range(len(k)):
      print dic[k[i]], k[i]
  </code></pre>
  
  <p>The above code displays correctly now! Thanks.</p>
  
  <p>6 199.21.99.83</p>
  
  <p>1 5.63.145.71</p>
  
  <p>EDIT: So how about adding c into my output now, the timestamps are going to differ obviously, but just getting one of the values, on the same line, is that possible?</p>