خرید بک لینک

Vote count: 1

I am making my first Python project. I am trying to scrape a web page like this:

page = requests.get('http://www.mypage.com')
tree = html.fromstring(page.content)
table = tree.xpath('//table[@class="list"]')

However, I'm not sure if the table retued is correct.

Is there a way of checking the html content from the table?

If I try doing this:

print str(table)

I get this output, which is not very useful:

[<Element table at 0x10b20b6d8>]

asked 5 mins ago

1 Answer

Vote count: 1

You can use tostring() to print raw HTML of the element :

from lxml import html

.....

html.tostring(table[0])

answered 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 7 ارديبهشت 1395 ساعت: 20:00

صفحه بندی