Don't put in spurious newline

This commit is contained in:
David Baker 2017-06-13 11:54:28 +01:00
parent 89c7477bd6
commit 4eb7419335
2 changed files with 4 additions and 4 deletions

View file

@ -38,9 +38,10 @@ with open(dstpath) as ifp:
elif strippedline.endswith(','):
ofp.write(line)
else:
ofp.write(' '+strippedline)
ofp.write(",\n")
toAddStr = json.dumps(toAdd, indent=4, separators=(',', ': '), ensure_ascii=False, encoding="utf8")[1:-1]
ofp.write(' '+strippedline+',')
toAddStr = json.dumps(toAdd, indent=4, separators=(',', ': '), ensure_ascii=False, encoding="utf8").strip("{}\n")
ofp.write("\n")
ofp.write(toAddStr.encode('utf8'))
ofp.write("\n")
os.rename(tmppath, dstpath)