开发者

Assigning xml structured output from webservice method in python

I'm calling a method called getNewReports() of a webservice. This method takes in a u开发者_Go百科sername and password and outputs xml structured data.

How can I assign this xml output to a variable in python. If I just do:

 reportxml = client.service.GetNewReports(username=user,password=pw)
 print reportxml

It's printing this: (ArrayOfString){ string[] = abcd,efgh }

I need the information in the string array. How can I create a separate array of values using the data from the String[] array ? Or how can assign an xml type variable to the output so I can parse the whole thing as an xml file?

Thanks for your help!


The datatype you recieve from calling GetNewReports is an ArrayOfString. The problem is, I don't know what methods this type supports.
Call help(reportxml) or print dir(reportxml) to see a list of it's methods and attributes or take a look into the client.service documentation (if any) to get information about this type and watch out for a way to extract the information it contains.

Hint: Actually in every languange, an array-like datatype supports indexing using [index].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜