本文整理汇总了Python中util.ElementHelper.print_element方法的典型用法代码示例。如果您正苦于以下问题:Python ElementHelper.print_element方法的具体用法?Python ElementHelper.print_element怎么用?Python ElementHelper.print_element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.ElementHelper
的用法示例。
在下文中一共展示了ElementHelper.print_element方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_cluster_record
# 需要导入模块: from util import ElementHelper [as 别名]
# 或者: from util.ElementHelper import print_element [as 别名]
def print_cluster_record(cls, clusters, doctree):
ElementHelper.print_element(doctree)
for cluster in clusters:
if len(cluster)>1:
print '===='*10
nodes = clusters[cluster]
for node in nodes:
print ElementHelper.get_xpath_by_element(node, doctree), node.get(py)
示例2: WISH
# 需要导入模块: from util import ElementHelper [as 别名]
# 或者: from util.ElementHelper import print_element [as 别名]
if __name__ == '__main__':
import lxml.etree as etree
doc1 = etree.fromstring(html1)
doc2 = etree.fromstring(html2)
root1 = ElementHelper.get_root(doc1)
root2 = ElementHelper.get_root(doc2)
w = WISH()
# print w.similar_check(root1, root2)
dir = 'D:/OtherWork/CETD_DATA/BBC/original/0.htm'
dir = '/mnt/UbutunShare/Work/CETD_DATA/BBC/original/71.htm'
dir = '/mnt/UbutunShare/Work/CETD_DATA/Final/original/60.html'
# dir = '/mnt/UbutunShare/Work/CETD_DATA/wiki/original/1.htm'
from util import FileHelper
content = FileHelper.readUTF8File(dir)
doc = HtmlHelper.create_doc(content, 'utf-8')
doc = HtmlHelper.pre_process_domtree(doc)
article,title = HtmlHelper.get_article(doc, False)
ElementHelper.print_element(doc)
print article.encode('utf-8')