Created
April 13, 2017 09:14
-
-
Save kosho/e4880fa71c3360cb00f1cbd59f3fc8a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import codecs | |
import csv | |
import json | |
csvfile = open(sys.argv[1], 'rU') | |
header_reader = csv.reader(csvfile) | |
header = next(header_reader) | |
reader = csv.DictReader(csvfile, header) | |
for row in reader: | |
print "{\"index\":{}}" | |
print json.dumps(row, sort_keys=False, ensure_ascii=False, encoding='utf_8') | |
csvfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment