Python scraping via xml prints empty brackets
<p>I am trying to extract just a few characters from a website via lxml, to tree, then xpath. I've tried using google chrome to obtain the correct xpath yet it prints empty brackets.</p>

<pre><code>    #imports
    from lxml import html
    import requests

    #get magicseaweed Scripps report
    msScrippsPage = requests.get("""http://magicseaweed.com/Scripps-Pier-
    La-Jolla-Surf-Report/296/.html""")

    #make tree from site
    msScrippsTree = html.fromstring(msScrippsPage.content)

    #get wave size
    msScrippsWave = msScrippsTree.xpath("""/html/body/div[2]/div[5]/div/div[1]/div[2]/div[2]/div/div[2]/div[1]/div/div[1]/div/div/div/div/div[1]/div/div[2]/ul[1]/li[1]/text()""")

    print 'ms SCripps: ', msScrippsWave
</code></pre>

<p>The output to terminal is 'msScripps: [ ]'</p>

<p>You shouldn't use line break in your url. When you use one line your xpath work.</p>

<pre><code>msScrippsPage = requests.get("""http://magicseaweed.com/Scripps-Pier-La-Jolla-Surf-Report/296/.html""")
print msScrippsPage.content
['    0.4-0.6', '   ']
########################################
url = """http://magicseaweed.com/Scripps-Pier-
La-Jolla-Surf-Report/296/.html"""
print url
'http://magicseaweed.com/Scripps-Pier-\n    La-Jolla-Surf-Report/296/.html'
</code></pre>

<p>Edit: Add full example</p>

<pre><code>from lxml import html
import requests

msScrippsPage = requests.get("""http://magicseaweed.com/Scripps-Pier-La-Jolla-Surf-Report/296/.html""")
msScrippsTree = html.fromstring(msScrippsPage.content)
msScrippsWave = msScrippsTree.xpath("""/html/body/div[2]/div[5]/div/div[1]/div[2]/div[2]/div/div[2]/div[1]/div/div[1]/div/div/div/div/div[1]/div/div[2]/ul[1]/li[1]/text()""")
print 'ms SCripps: ', msScrippsWave
</code></pre>

python xml xpath web-scraping