Created
March 10, 2020 17:08
-
-
Save amalgjose/edf665cf30e0b40d7623a71db662c300 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
import csv | |
import json | |
csv_file = open('data.csv', 'r') | |
json_file = open('data.json', 'w') | |
fieldnames = ("EmpID","FirstName","LastName","Salary") | |
reader = csv.DictReader( csv_file, fieldnames) | |
for row in reader: | |
json.dump(row, json_file) | |
json_file.write('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment