---
# System prepended metadata

title: Untitled

---

``` python
# f1 = open("data.txt", "w")
# f1.write("name,dept,loc,salary\n")
# f1.write("arun,sales,blr,15000\n")
# f1.write("ravi,purch,chn,25000\n")
# f1.write("hari,sales,hyd,18000\n")
# f1.write("john,sales,mum,20000\n")
# f1.write("guru,purch,blr,15000\n")
# f1.write("manu,accts,blr,18000")
# f1.close()
# a = {
#  "sales" : ["arun","hari","john"],
#  "purch" : ["ravi","guru"],
#  "accts" : ["manu"]
#  }

import csv

from pprint import pprint

reader = csv.reader(open("data.txt", "r"))
d   = {}
next(reader)
for row in reader:
    name,dept,loc,salary = row
    if dept not in d:
        d[dept] = []
    d[dept].append(name)

pprint(d)
```