Skip to content

Commit

Permalink
csv python parser
Browse files Browse the repository at this point in the history
  • Loading branch information
lushl9301 committed Jun 27, 2015
1 parent 9770096 commit 40707c2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions csvParser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import csv
import json


jsonFile = open("raw_data.json", "a")
with open('export.csv') as csvFile:
csvFile.readline()
fieldNames = csvFile.readline().replace('\n','').split(',')
reader = csv.DictReader(csvFile, fieldNames)
for row in reader:
tempDict = {}
tempDict["url"] = row['PDF Link']
tempDict["abstract"] = row['"Abstract"']
tempDict["authors"] = [row['Authors']]
tempDict["title"] = row['"Document Title"']
json.dump(tempDict, jsonFile)
jsonFile.write("\n")

0 comments on commit 40707c2

Please sign in to comment.