title: innerhtml equivalent using cssselect in lxml.html
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6123351/equivalent-to-innerhtml-when-using-lxml-html-to-parse-html">Equivalent to InnerHTML when using lxml.html to parse HTML</a>  </p>
  </blockquote>
  
  
  
  <p>What is the equivalent of innerHTLML for cssselect using lxml.html with python 2.7?</p>
  
  <pre><code>import lxml.html, cssselect
  
  doc = lxml.html.document_fromstring(htmldocstring)
  e = doc.cssselect('div.mainl')[0]
  print e.innerHTML #This doesn't work
  </code></pre>
  
  <p>How do I get the inner/outer html of e?</p>
  
  <p><strong>Outer html</strong>
  To get the outer html you do:</p>
  
  <pre><code>print lxml.html.tostring(e)
  </code></pre>
  
  <p>Still don't know how to get innerHTML.</p>