#!/usr/bin/env python
import json

csv = open('uk-postcode.csv')
store = {}
while True:
   line = csv.readline()
   if len(line) == 0:
       break
   else:
       d = [p.replace('"', '').strip() for p in line.split(',')]
       print d[0], d[5], d[6]
       store[d[0]] = {'town': d[5], 'county': d[6]}

json.dump(store, open('uk-postcode', 'w'))
