Last active
July 8, 2016 02:10
-
-
Save NEJmark/4a98f06059a3cecc7af6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xpath筆記 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import lxml.etree as etree | |
#etree.HTML(data) | |
page.xpath('//tr/td[contains(text(),"2015/09/09")]/following-sibling::*') | |
#取得tr下td 屬性中的文字包含2015/09/09其之後所有的td節點 | |
page.xpath('//td[@class="cr"]) | |
#取得所有 屬性class = cr 的td節點 | |
#or opteration | |
page.xpath('(.//tr[@class="even"]|.//tr[@class="odd"])') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment