Python获取xml数据

时间:2022-07-25
本文章向大家介绍Python获取xml数据,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
def get_store(self,):
    try:
        resp=session.get(url=self.base_url,headers=self.headers,verify=False).content.decode()
        result = etree.XML(resp)
        self.data_list=result.xpath('//shop/@v')
        logging.info(self.data_list)
    except Exception:
        traceback.print_exc()