使用python将数据库中的属性文件转换为JSON格式

2024-09-27 23:19:25 发布

您现在位置:Python中文网/ 问答频道 /正文

例如:

activ.contributionGateway.serviceId=Service.ContributionGateway
activ.contributionGateway.url= google.com
activ.contributionGateway.connectionRetry.interval=5
activ.contributionGateway.connectionRetry.timeout=60
activ.contributionGateawy.FDG.PermissionId=6710
activ.contentGateway.serviceId=Service.ContentGateway
activ.contentGateway.url=google.com
activ.contentGateway.connectionRetry.interval=5
activ.contentGateway.connectionRetry.timeout=60

输出应如下所示:

 {  
           "Activ":{  
              "contributiongateway":{  
                 "serviceId":"Service.ContributionGateway",
                 "url":"google.com",
                 "connectionRetry":{  
                    "interval":5,
                    "timeout":60,

                 }         "FDG":{  
                    "PermissionId":6710,

                 }
              }      "contentGateway":{  
                 "serviceId":"Service.ContentGateway",
                 "url":"google.com",
                 "connectionRetry":{  
                    "interval":5,
                    "timeout":60
                 }
              }
           }
        }

如何使用python处理所有花括号以及所有子元素和新元素


Tags: comidurlservicegoogletimeoutintervalactiv

热门问题