成人黄网站A片免费观看,欧美人妻少妇精品久久黑人,国产内射999视频一区,国产成年女人毛片80S网站

Section Menu:  

xml轉(zhuǎn)字典函數(shù):xml_data()

  • 發(fā)布時間: 2020-03-31 14:45
  •    閱讀: 2553   

描述

xml_data() xml轉(zhuǎn)字典
xml_data() 接收一個參數(shù),第一個參數(shù)為要轉(zhuǎn)換的xml數(shù)據(jù)


語法

以下是 xml_data() 的語法:

xml_data(data)

參數(shù)

    ● data [類型]:需要轉(zhuǎn)字典的xml數(shù)據(jù)。


返回值

返回一個dict類型的數(shù)據(jù)


實(shí)例

以下展示了使用 xml_data() 的實(shí)例:

from kyger.common import xml_data
data = """
<xml>
  <ToUserName><![CDATA[toUser]]></ToUserName>
  <FromUserName><![CDATA[fromUser]]></FromUserName>
  <CreateTime>1348831860</CreateTime>
  <MsgType><![CDATA[text]]></MsgType>
  <Content><![CDATA[this is a test]]></Content>
  <MsgId>1234567890123456</MsgId>
</xml>"""
print(xml_data(data))

以上實(shí)例運(yùn)行后輸出的結(jié)果為:

{'ToUserName': 'toUser', 'FromUserName': 'fromUser', 'CreateTime': 1348831860, 'MsgType': 'text', 'Content': 'this is a test', 'MsgId': 1234567890123456}

適應(yīng)版本

v1.0.1