Python JSON文件编写

时间:2015-08-05 14:32:07

标签: python json

我正在尝试在我的python脚本中编写一个JSON文件,我有以下内容:

#write JSON file:
data = {
   'description' : 'ACME',
   'taskType' : 100,
   'scanFileTypes' : 542.23,
   'connections' : connectionName,
   'fileTypeExclude' : False,
   'policies': 'PCI_Hadoop'
}



with open(jsonPropPath, 'w') as outfile:
    json.dump(data, outfile, ensure_ascii=False)

我的JSON文件如下:

cat /home/matt/DGagent/jsonFile_20150805102636.json

{"description": "ACME", "scanFileTypes": 542.23000000000002, "connections": "dgcl_20150805102636", "policies": "PCI_Hadoop", "taskType": 100, "fileTypeExclude": false}[matt@server1 ~]

正如你所看到的,正在扩展小数,它还添加了服务器:[matt @ server1~]

有人可以帮我纠正这些问题吗?

0 个答案:

没有答案