from scrapy.selector import Selector htmlText=''' Harry Potter 29.99 学习 XML 39.95 ''' selector=Selector(text=htmlText) ____________________________________ print(s.extract_first()) ____________________________________ print(s.extract_first()) 程序结果: Harry Potter 学习 XML
A.
s=selector.xpath("//book[position=1]/title"); s=selector.xpath("//book[position=2]/title")
B.
s=selector.xpath("//book[position()=1]/title"); s=selector.xpath("//book[position()=2]/title")
C.
s=selector.xpath("//book[position()=2]/title"); s=selector.xpath("//book[position()=1]/title")
D.
s=selector.xpath("//book[position=2]/title"); s=selector.xpath("//book[position=1]/title")