I am working with xml file using lxml etree xpath method. My code is
from lxml import etree
File="c:\file.xml"
doc=etree.parse(File)
alltext = doc.xpath('descendant-or-self::text()')
clump = "".join(alltext)
clump
I got the following output:
"'\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\
I want to remove spaces and all tabs from output, so I use another code but failed to get the desired output
Here is that code
import string
filter(lambda x: x in string.printable, clump)
I only want to get text from output which is "Introduction , Accessibilty , Opening eBooks"