I am using Python 2.7 lxml and I am having problems finding the table.
Finding it by id od class produces null result.
a = [c.text for c in kontent.xpath('//table[@id="blk-ctnt-2308"[1]//tr/td[5]]
Any other suggestions?
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are missing square brackets in the XPath expression, before the index
[1]:Also, you may want to check if the first part of the expression works
//table[@id="blk-ctnt-2308"][1]before you try out the full one.Finally, if the source table has an
idattribute, the index[1]is redundant but should still work.Update
I can’t use
lxmlon this machine, so I am using the ElementTree XML API in order to test the XPath, this code:Produces this output: