Check if element returned by xpath is correct
Question: 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 returned 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>]
    


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

    
    
    from lxml import html
    
    .....
    
    html.tostring(table[0])
    

