摘要: from xml.etree import ElementTree as ET from xml.dom import minidom def MyXMLWrite(root, path): rough_string = ET.tostring(root, encoding='utf-8') rep 阅读全文
posted @ 2021-02-16 17:51 xuwenwei 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 利用文件夹中 C:\Python38\Lib\xml\dom 中有一个minidom.py 中的方法。 1. 把内存中的根节点 root, 利用ET.tostring 转换成紧凑型的string 2. 利用minidom中parseString的方法,把上述紧凑型的字符串重新解析reparsed 3 阅读全文
posted @ 2021-02-16 17:28 xuwenwei 阅读(514) 评论(0) 推荐(0) 编辑
摘要: from xml.etree import ElementTree as ET # 方式一,通过Element这个类来创建element # 创建element ele = ET.Element("Family", {"age": "40"}) # 创建ElementTree tree = ET.E 阅读全文
posted @ 2021-02-16 16:49 xuwenwei 阅读(521) 评论(0) 推荐(0) 编辑
摘要: 对http发起请求,获取请求的返回值,返回的是字符串形式的, jason数据(类似字典,列表的字符串) XML HTML 方法一: 使用 urllib模块。 from urllib import request# f = request.urlopen("https://www.cnblogs.co 阅读全文
posted @ 2021-02-16 12:25 xuwenwei 阅读(396) 评论(0) 推荐(0) 编辑