# Collection of code snippets by Arne Vajhøj 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import csv

res = { }
with open('in.txt', newline='') as f:
    rdr = csv.DictReader(f, delimiter=',', fieldnames=['name','id','status'])
    for line in rdr:
        if line['status'].strip() == 'valgt':
            res[line['id'].strip()] = line['name'].strip()
print(res)
