Skip to content

Instantly share code, notes, and snippets.

@sreevardhanreddi
Last active March 14, 2019 16:20
Show Gist options
  • Save sreevardhanreddi/5ff0203e51d963a77e239b70dc3b6ba8 to your computer and use it in GitHub Desktop.
Save sreevardhanreddi/5ff0203e51d963a77e239b70dc3b6ba8 to your computer and use it in GitHub Desktop.
import csv
import json
def csv_to_json_conversion(file_name):
json_file_name = 'jsonl__42kod.json'
with open(file_name, 'r') as f:
r = csv.reader(f)
head = next(r)
reader = csv.DictReader(f, head)
with open(json_file_name, 'a+') as fn:
for i in reader:
fn.write(json.dumps(i) + '\n')
csv_to_json_conversion('42kod.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment