我偶然发现了这段python代码
def parseXML(xmlfile):
# create element tree object
tree = ET.parse(xmlfile)
# get root element
root = tree.getroot()
# create empty list for news items
newsitems = []
# iterate news items
for item in root.findall('./channel/item'):
# empty news dictionary
news = {}
# iterate child elements of item
for child in item:
# special checking for namespace object content:media HERE
if child.tag == '{http://search.yahoo.com/mrss/}content': #HERE
news['media'] = child.attrib['url'] #HERE
else:
news[child.tag] = child.text.encode('utf8')
# append news dictionary to news items list
newsitems.append(news)
# return news items list
return newsitems
有人能告诉我这是什么内容:媒体检查这里吗?我们为什么要这样做?我在互联网上找不到关于这到底是什么的意义
这是SOAPAPI元素。例如:
在上一个XML文件中,如果要获取
<Item>Apples</Item>
。您必须使用:相关问题 更多 >
编程相关推荐