step 1:练习XPATH 选取text-property标签具有name='text' 属性值的标签的值
//text-property[@name='text']
import os import lxml.etree as etree dir = "E:\\" for file in os.listdir(dir): if file.endswith('.rptdesign'): with open(dir+file,'r',encoding='utf-8') as f: first_line = f.readline() xml_content = f.read() selector = etree.HTML(xml_content) str = selector.xpath('//text-property[@name="text"]/text()') print(str)
获取Tile,Description,Columns
step2 使用AI 在word 方面的自动转化功能