Skip to content
This repository
branch: master
gka
file 17 lines (13 sloc) 0.304 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import json
import sys

in_file = sys.argv[1]
out_file = sys.argv[2]
cities = json.loads(open(in_file).read())
out = []

keep = ('city_name', 'nb_visits', 'long', 'lat')

for c in cities:
    o = dict()
    for p in keep:
        o[p] = c[p]
    out.append(o)

open(out_file, 'wb').write(json.dumps(out))
Something went wrong with that request. Please try again.