- 容联云通讯是第三方平台,能够提供短信验证码和语音通信等功能,这里只测试使用短信验证码的功能,因此只需完成注册登录(无需实名认证等)即可使用其短信验证码免费测试服务。
- python3 的代码示例
-
xmltojson.py文件
import os import xml.etree.ElementTree as ET from xml.dom import minidom class xmltojson: #global var #show log SHOW_LOG = True #XML file XML_PATH = None a={ } m=[] def get_root(self,path): '''parse the XML file,and get the tree of the XML file finally,return the root element of the tree. if the XML file dose not exist,then print the information''' #if os.path.exists(path): #if SHOW_LOG: #print('start to parse the file : [{}]'.format(path)) tree = ET.fromstring(path) return tree #else: #print('the path [{}] dose not exist!'.format(path)) def get_element_tag(self,element): '''return the element tag if the element is not None.''' if element is not None: return element.tag else: print('the element is None!') def get_element_attrib(self,element): '''return the element attrib if the element is not None.''' if element is not None: return element.attrib else: print('the element is None!') def get_element_text(self,element): '''return the text of the element.''' if element is not None: return element.text else: print('the element is None!') def get_element_children(self,element): '''return the element children if the element is not None.''' if element is not None: return [c for c in element] else: print('the element is None!') def get_elements_tag(self,elements): '''return the list of tags of element's tag''' if elements is not None: tags = [] for e in elements: tags.append(e.tag) return tags else: print('the elements is None!') def get_elements_attrib(self,elements): '''return the list of attribs of element's attrib''' if elements is not None: attribs = [] for a in elements: attribs.append(a.attrib) return attribs else: print('the elements is None!') def get_elements_text(self,elements): '''
-
容联云短信测试
最新推荐文章于 2022-12-10 09:27:57 发布