[英]Extracting data from python wsdl client using suds
I have created the following Python code that reads a method from a webservice: 我创建了以下Python代码,该代码从Web服务读取方法:
def GetWeatherParameters():
""""""
client = Client('www.address.asmx?wsdl')
#WebServiceClient.GetWeatherParameters()
return client.service.GetWeatherParameters()
It works fine and I get the data returned and can print it, however the data returned contains mutltiple columns and this code just prints out everything at once. 它工作正常,我得到返回的数据并可以打印它,但是返回的数据包含多个列,此代码可以一次打印出所有内容。
Does anybody know how I can extract the returned data column by column? 有人知道如何逐列提取返回的数据吗?
It all depends on the returned data - a handy way to display it nicely is to use pprint
: 这一切都取决于返回的数据-一种很好地显示它的简便方法是使用
pprint
:
from pprint import pprint
pprint(your_data)
That'll format it nicely so it's easier to see the structure. 这样可以很好地格式化它,因此更容易看到结构。 Then if it's a list or similar, to get the first row you can do your_data[0] to get the first one, or loop, to print it row by row:
然后,如果是列表或类似列表,则要获取第一行,可以执行your_data [0]以获取第一行或循环以逐行打印:
for row in your_data:
print row
print row[0] # could be the first column...
And go from there... 然后从那里去...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.