我经历Asheesh Laroia的使用的getElementsByTagName“刮网站”从2010年PYCON介绍和我有一个关于一个特定的代码行的问题是这一行:从xml.dom.minidom
title_element = parsed.getElementsByTagName('title')[0]
从功能:
def main(filename):
#Parse the file
parsed = xml.dom.minidom.parse(open(filename))
# Get title element
title_element = parsed.getElementsByTagName('title')[0]
# Print just the text underneath it
print title_element.firstChild.wholeText
我不知道“[0]”是在该行的末尾执行什么样的作用。 'xml.dom.minidom.parse'是否将输入解析到列表中?