lxml
Splitting a HTML document using lxml.html
I have a HTML document containing multiple chapters of text where the H1 tag 开发者_运维百科is the chapter separator. How can I split such a document into html snippets where each snippet starts with[详细]
2023-04-01 23:52 分类:问答LXML itertree parsing tag information
I have been searching around for answers, but I can\'开发者_如何学编程t seem to find anything.[详细]
2023-04-01 12:12 分类:问答in lxml.html how do i grab the text, children and content of children of a node?
开发者_C百科I\'m using python\'s lxml.html. I have an xpath expression which grabs the text of a node but what I need is all the text including the tags of the children tags and their content. How do[详细]
2023-03-31 15:30 分类:问答Replace text with HTML tag in LXML text element
I have some lxml element: >> lxml_element.text \'hello BREAK world\' I need to replace the word BREAK with an HTML break tag—<br />. I\'ve tried to do simple text replacing:[详细]
2023-03-31 09:29 分类:问答Encode unicode chars to HTML entities in Python, excluding tags
As you may know, for an email to be valid in many clients, all unicode chars must be encoded. I would like to automate this encoding in a Python script.[详细]
2023-03-31 00:19 分类:问答Does lxml parse HTML contextually?
I\'m using lxml to parse HTML: >>> from lxml.html import fromstring, tostring It parses trailing whitespace correctly in some cases:[详细]
2023-03-30 19:48 分类:问答fromstring() -> tostring() modifies the overall HTML structure
I am trying to use lxml.html for writing a cleanup routine to remove empty DIV elements having no content. During the debugging I noticed that[详细]
2023-03-30 07:24 分类:问答Xpath doesn't match
I\'m trying to get some elements from a page. Unfortunatel开发者_开发知识库y it results with an empty list. The pretty-printed tree includes this element:[详细]
2023-03-29 05:51 分类:问答Matching text with xpath?
I\'m screen-scraping an HTML page which contains: <table border=1 class=\"searchresult\" cellpadding=2>[详细]
2023-03-27 17:30 分类:问答How to tell lxml.etree.tostring(element) not to write namespaces in python?
I have a huge xml file (1 Gig). I want to move some of the elements (entrys) to another file with the same header and specifications.[详细]
2023-03-27 12:38 分类:问答