Created
December 9, 2013 08:31
-
-
Save sarim/7869105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
gamelog = "./games.log" | |
scoredb = {} | |
def addscore(killer): | |
if killer not in scoredb: | |
if re.search('_\d+$',killer): | |
originalkiller = re.search('(.*)_\d+$',killer).groups()[0] | |
addscore(originalkiller) | |
else: | |
scoredb[killer] = 0 | |
else: scoredb[killer] += 1 | |
for line in open(gamelog,'r'): | |
players = re.search("(\S+) killed (\S+) by (\S+)" , line) | |
if players is not None: | |
killer = players.groups()[0] | |
addscore(killer) | |
print scoredb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment