2016-10-03 26 views

答えて

1

代わりの.texttext_content()メソッドを使用します。

In [5]: a.find(".//i").getparent().text_content().strip() 
Out[5]: 'sometext' 

それとも、あなたがi要素のテキスト兄弟次に取得することができます。

In [6]: a.xpath(".//i/following-sibling::text()")[0].strip() 
Out[6]: 'sometext' 
関連する問題