Skip to content

Commit

Permalink
add csv parser module
Browse files Browse the repository at this point in the history
  • Loading branch information
lushl9301 committed Jun 27, 2015
1 parent b0ba34c commit 2771c9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@rm -f [1]myFormat.txt
@touch [1]myFormat.txt
python csvParser.py
#mv csv file in case make next
@mv export.csv export.csv.b
@mv export.csv export.csv.b 2>/dev/null; true #mv csv file in case make next
@rm -f temp.json
perl preProcess.pl >> [1]myFormat.txt
perl jsonParser.pl >> [1]myFormat.txt
@echo ==============================================================
Expand Down
7 changes: 4 additions & 3 deletions csvParser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv
import json
import sys
import os

try:
with open('export.csv') as csvFile:
Expand All @@ -17,8 +17,9 @@
tempDict["title"] = row['"Document Title"']
json.dump(tempDict, jsonFile)
except:
print "Error: only support csv file provided by ieee xplore"
sys.exit()
print "Error: only support csv file provided by ieee xplore."
print "Make sure the file name is export.csv."
os._exit(0)
jsonFile.close()
jsonFile = open('temp.json', "r")
with open('raw_data.json', "a") as dataFile:
Expand Down

0 comments on commit 2771c9a

Please sign in to comment.