标签:
#resthread.xml <?xml version=‘1.0‘ encoding=‘UTF-8‘?> <limit> <data name=‘thread_nu‘ value=‘3‘ /> </limit>
from xml.dom.minidom def getConfig(): xml_path = resthread.xml config = {} root = xml.dom.minidom.parse(xml_path) xml_root = root.documentElement nodes = xml_root.getElementsByTagName(‘data‘) for node in nodes: config[node.getAttribute(‘name‘)] = node.getAttribute(‘value‘) return config def threadNu(): config = {} config = getConfig() nu = config[‘thread_nu‘]
标签:
原文地址:http://www.cnblogs.com/xzhdream/p/5461126.html