Commit 12efb152 by Anselm Jia

to json

parent 8d16ddb7
Showing with 14 additions and 0 deletions
import json
def to_json(filename, dataname):
resultdict = {}
with open(filename) as resultfile:
results = resultfile.readlines()
for result in results:
name, score = result.split("\t")
name = name.replace('"', '')
score = score.strip()
resultdict[name] = float(score)
with open(dataname, 'w') as datafile:
json.dump(resultdict, datafile)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment