
f = open("chat.txt", "r")
s = f.read()
f.close()

lines = s.split("\n")
names = [ ]
for line in lines:
    start = line.index("From ")
    line = line[start + len("From "):]
    end = line.index(" : ")
    line = line[:end]
    line = line.strip()
    
    if "(Privately)" in line:
        end = line.index(" to ")
        line = line[:end]
        line = line.strip()
    
    if line not in names:
        names.append(line)

print(names)

import csv

f = open("icecream.csv", "r", encoding="utf8")
reader = csv.reader(f)
data = list(reader)
f.close()

data[0].pop(0)
data[0].append("# Chocolate")
for row in range(1, len(data)):
    data[row].pop(0)
    chocCount = 0
    for col in range(len(data[row])):
        data[row][col] = data[row][col].lower()
        if "choc" in data[row][col]:
            chocCount += 1
    
    data[row].append(chocCount)
print(data)