Parse data from html page to table
Question: I would like make table of chosen physical properties of elements (for example
atomization enthalpy, vaporization enthalpy, heat of vaporization, boiling
point), which are accessible on [this
page](http://environmentalchemistry.com/yogi/periodic/W.html).

It is a huge pain to do it by hand, and I didn't find any other machine-
processing-friendly source of such data on the internet.

I was trying to learn how to to do it in Python (because I want to use this
data for my other code written in Python / NumPy / Pandas).

I was able to download the webpage HTML code with urllib2, and I was trying to
learn how to use some HTML/XML parser like ElementTree or MiniDom. However I
have no experience with web programing and HTML/XML processing.


Answer: Using lxml's xpath support, you can parse the data easily. Here's an example
parsing the atomization enthalpy

    
    
    import lxml.html
    import urllib2
    
    html = urllib2.urlopen("http://http://environmentalchemistry.com/yogi/periodic/W.html").read()
    doc = lxml.html.document_fromstring(html)
    result = doc.xpath("/html/body/div[2]/div[2]/div[1]/div[1]/ul[7]/li[8]")
    

You could dynamically generate the xpath string for the different elements,
and use a dict to parse the require fields.

