使用Python将此数据格式化为XML或JSON

2024-10-03 02:36:59 发布

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

我有一个soapweb服务,我正在用Python发布一个请求,但是我不知道如何格式化返回。你知道吗

更新:Return是SUDS返回的“实例”

我只返回了40张唱片中的一张,包括:

print len(xmloutput)
print len(xmloutput[1].ODI_Outage)
print xmloutput[1].ODI_Outage[6]

这是我得到的回报:

2
40
(ODI_Outage){
   metersAffected = 28
   ERT = 
      (ert_time){
     ert = "2013-07-19T20:50:00Z"
  }
 Incident = 
  (incident){
     Location = 
        (location){
           mainAddress = 
              (mailaddress){
                 townDetail = 
                    (towninfo){
                       code = "L7L6W3"
                       name = "BURLINGTON"
                       stateOrProvince = "ONTARIO"
                    }
              }
           PositionPoints = 
              (coordinates){
                 xPosition = -79.7833492971
                 yPosition = 43.3923166879
              }
        }
    }
 }           

如何获取此返回并为所有ODI\u对象创建XML或JSON?只是不知道该怎么办。你知道吗


Tags: 实例lenreturntimesudsprintincidentoutage