# coding=utf-8
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import
from pprint import pprint
# import sys
# default_encoding = 'utf-8'
# if sys.getdefaultencoding() != default_encoding:
#    reload(sys)
#    sys.setdefaultencoding(default_encoding)

url ='http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl'
imp = Import('http://www.w3.org/2001/XMLSchema')    # the schema to import.
imp.filter.add('http://WebXml.com.cn/')  # the schema to import into.
d = ImportDoctor(imp)
client = Client(url, doctor=d)
nms=u"广东"
result = client.service.getSupportCity(nms)
print nms
mylogfile = 'log.txt'
f = open(mylogfile, 'a')
f.write('i am logging! timber!....\n')
#f.write(result)

pprint (result[0][0])
for rt in result[0]:
    print rt
    f.write(rt)
f.close()

 

相关文章:

  • 2021-08-15
  • 2021-09-15
  • 2021-08-21
  • 2021-07-18
  • 2021-10-15
  • 2021-12-05
  • 2021-10-29
  • 2022-02-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2017-12-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
相关资源
相似解决方案