Skip to content

Instantly share code, notes, and snippets.

@cbertelegni
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save cbertelegni/78903b2e4322320efddf to your computer and use it in GitHub Desktop.

Select an option

Save cbertelegni/78903b2e4322320efddf to your computer and use it in GitHub Desktop.
Export with Python a json from csv file.
#! python
import csv, json
path = "app/data"
csv_path = "%s/nisman.csv" % path
data_out_path = "%s/data.json" % path
reader = csv.DictReader(open(csv_path))
data = [r for r in reader]
f = open(data_out_path, "w")
f.write(json.dumps(data, 1))
f.close
print "ok!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment