Xpath Parsing The Whole Page When I Specify Not To February 22, 2023 Post a Comment I'm parsing websites using python and XPath. What I'm trying to do is to extract the href from the So here's how is the XML (page): Solution 1: An XPath starting with a / character means that it will be begin at the document root node. To create a relative XPath from the context node, you need to put a . before the /. So your code should be: posts = page.xpath("//div[@id='posts']/div[@align='center']") for post in posts: print post.xpath(".//table/tr[1]/td[2]/a/@href") Copy Baca JugaIn Julia, Insert Commas Into Integers For Printing Like Python 3.6+Flask App Won't Run On HerokuGae Python: Parsing Compressed Xml Exceeds Memory Share You may like these postsMatplotlib Vline Label Parameter Not ShowingPython/json - Does Order Matter And Why Is This Json Post To A Rest Api Failing?Insert Data Into Mysql Table From Python ScriptBootstrapping A Web Server In Scala Post a Comment for "Xpath Parsing The Whole Page When I Specify Not To"
Post a Comment for "Xpath Parsing The Whole Page When I Specify Not To"