daily pastebin goal
26%
SHARE
TWEET

Untitled

Conderoga Aug 16th, 2012 21 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/python2
  2.  
  3. import os
  4. listing = os.listdir('.');
  5. smiles = ['xd', 'xp' 'x)' 'x(', ':)', ':(', ':d', ':p', ':o', '=d', '=p', '=o', '=)', ':\'(', '>:(', ';)']
  6. names = ['leha','le(eh)ah', 'lhudson', 'leah', '(")>']
  7.  
  8. messageCount = 0;
  9. smileyCount = 0;
  10.  
  11. for file in listing:
  12.     log = open(file,'ro')
  13.     for line in log:
  14.         toParse = line.lower();
  15.         for name in names:
  16.             if '<b>'+name+':' in toParse:
  17.                 messageCount += 1
  18.                 for smile in smiles:
  19.                     if smile in toParse:
  20.                         smileyCount += 1
  21.                     if smile[::-1] in toParse:
  22.                         smileyCount += 1
  23. print str(smileyCount) + '/' + str(messageCount) + ' = ' + str(float(smileyCount)/messageCount)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top