Last active
September 21, 2015 10:31
-
-
Save dmitrydyomin/59acbe7f3a47c9ab27ac to your computer and use it in GitHub Desktop.
Simple Quake III Arena log analyser (scores only)
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 | |
with open("games.log", "r") as myfile: | |
data = myfile.read() | |
results = {} | |
players = {} | |
for time, score, ping, name in re.findall('(\d+:\d+)\s+score:\s+([-\d]+)\s+ping:\s+(\d+)\s+client:\s+\d+\s+(.*)', data): | |
if not time in results: | |
results[time] = {} | |
results[time][name] = score | |
players[name] = name | |
print "\t".join(players) | |
for time, game in results.iteritems(): | |
scores = [] | |
for player in players: | |
scores.append(game[player] if player in game else '') | |
print "\t".join(scores) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment