xml里有空格使用python去除
xml的方法没有有效方法,直接上代码
with open(xml_path,"r") as f:
res = f.readlines() #res 为列表
res = [x for x in res if x.split()] #将空行从 res 中去掉
with open(xml_path,"w") as f:
f.write("".join(res)) #将 res 转换为 字符串重写写入到xml
...
原创
2020-05-19 20:25:55 ·
1333 阅读 ·
0 评论