title: Removing spaces and non-printable character in Python
body: <p>I am working with xml file using lxml etree xpath method. My code is</p>
  
  <pre><code>from lxml import etree
  File="c:\file.xml"
  doc=etree.parse(File)
  alltext = doc.xpath('descendant-or-self::text()')
  clump = "".join(alltext)
  clump
  </code></pre>
  
  <p>I got the following output:</p>
  
  <pre><code>             "'\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\t\n\t\n\t\t\n\t\t\t\n\t\t\t\tIntroduction\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\tAccessibility\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\tOpening eBooks\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\
  </code></pre>
  
  <p>I want to remove spaces and all tabs from output, so I use another code but failed to get the desired output<br/>
  Here is that code<br/></p>
  
  <pre><code>import string
  filter(lambda x: x in string.printable, clump)
  </code></pre>
  
  <p>I only want to get text from output which is "Introduction , Accessibilty , Opening eBooks"</p>