#!/usr/bin/env python3 users = {} emojis = {} for line in open("foolsbot.log"): if line.startswith("[NEW EMOJI]"): emoji = line.split(":")[0].split(" ")[2].strip() if emoji not in emojis: emojis[emoji] = [0, 0] emojis[emoji][0] += 1 user = line.split(":")[1].strip() if not user in users: users[user] = [0, 0] users[user][0] += 1 if line.startswith("[DEL EMOJI]"): emoji = line.split(":")[0].split(" ")[2].strip() if emoji not in emojis: emojis[emoji] = [0, 0] emojis[emoji][1] += 1 user = line.split(":")[1].strip() if not user in users: users[user] = [0, 0] users[user][1] += 1 lusers = sorted(users.items(), key=lambda k: k[1][0] + k[1][1], reverse=True) lemojis = sorted(emojis.items(), key=lambda k: k[1][0] + k[1][1], reverse=True) print("User,Added,Removed") for luser in lusers: print("%s,%s,%s" % (luser[0], luser[1][0], luser[1][1])) print(",,") print("Emoji,Added,Removed") for lemoji in lemojis: print("%s,%s,%s" % (lemoji[0], lemoji[1][0], lemoji[1][1]))