python - How to write Json/dict into file with pretty print along with single quotes? -
i'm new stack overflow. it's first question here. i've data (json/dict). i'm writing file prefixing it's corresponding dictionary name below:
open(file_name,'w') fh: fh.write("dict_name = " + json.dumps(dict_values,indent=2)) this works totally fine, double quotes. need single quotes instead along pretty print/some readable format. tried json.dumps(dict_values,indent=2).replace("\"","'"), replaces double quotes single quotes it's neither idea nor correct way apply dictionary. please me?
Comments
Post a Comment