elementtree 非常新,所以我正在尝试为 xbmc 解析 tv 插件的 xml 文件。下面是我遇到问题的代码。我认为我的 xpath 不正确,并且占位符不适用于该属性!
这是我正在使用的 xml 文件 - http://services.tvrage.com/myfeeds/episode_list.php?key=ag6txjP0RH4m0c8sZk2j&sid=2930
seasonnum = root2.findall("/Show/Episodelist/Season[@no='%s']/episode/seasonnum" % (season))
import xml.etree.ElementTree as ET
import urllib
tree2 = ET.parse(urllib.urlopen(url))
root2 = tree2.getroot()
seasonnum = tree2.findall("./Episodelist/Season[@no='%s']/episode/seasonnum" % '1')
print seasonnum
SyntaxError:预期的路径分隔符([)是我得到的