title: python xpath IndexError: list index out of range
body: <p>I am grabbing a value from url source page by xpath. but this is not existed. so I want to <strong>pass</strong> the requests and try to grab that value again: what I tried:</p>
  <pre><code>import requests
  from lxml import html
  url='http://www.example.com'
  cont=requests.get(url)
  tree=html.fromstring(cont)
  out=tree.xpath('...')[0]
  </code></pre>
  <p>When I run it I have the following Error:</p>
  <pre><code>IndexError: list index out of range
  </code></pre>
  <p>How can I request for grabbing value again in this case?</p>
  <h1>update</h1>
  <p>I know this error means xpath doesn't exist. so I want to request to that url to grab xpath again.</p>