Improved the CSV format for D3 js

This commit is contained in:
Alexandre Dulaunoy 2017-04-21 10:56:47 +02:00
parent 82380cb7cf
commit 0198e4e03d

View file

@ -38,9 +38,10 @@ for field in fieldsSagan:
print (table)
elif args.csvd3js:
with open("{}/{}.csv".format(args.outputdir,field.upper()), 'w') as f:
f.write("id,value")
f.write("id,value\n")
for value in c:
f.write("{},{}\n".format(value[0].decode(),value[1]))
f.write("{},\n".format(value[0].decode()))
f.write("{},{}\n".format(value[0].decode(),int(value[1])))
else:
print ("You need a specify an output like --table or at least one of the options below")