Python标准模块——xml
来源:互联网 发布:f22到底有多先进知乎 编辑:程序博客网 时间:2024/06/10 09:19
8、 xml文件
这一模块的介绍方法区别于前面的模块介绍方法,根据使用顺序进行介绍。
import xml.etree.ElementTree
读取文件
tree = ElementTree.parse(xlsfile)root = tree.getroot()
读取tree中的某个tag
tags = root.getiterator(tag_name)
读取tag下属的tag
tag.findall('*/tag') #返回的是tags列表
#读取tag自身的属性和text
tag.attrib[attr_name]tag.text
0 0
- Python标准模块——xml
- Python标准库——os模块
- Python 标准库 —— os 模块
- Python标准模块——sys
- Python标准模块——os
- Python标准模块——glob
- Python标准模块——tempfile
- Python标准模块——shlex
- Python标准模块——subprocess
- Python标准模块——PIL
- Python标准模块——math
- python标准模块——time
- Python标准模块——gzip
- Python标准模块——__future__
- Python标准模块——argparse
- Python标准模块——pickle
- Python标准模块——shutil
- Python 标准库 —— xml
- Python标准模块——subprocess
- Python标准模块——PIL
- 软件工程导复习分析(简化版,不够详细,有干货)
- 快速排序
- 哈夫曼树
- Python标准模块——xml
- 使用protobuf(c++)的构建通用的数据系统(转)
- Python标准模块——math
- 辗转相除法
- Codeforces 460B Little Dima and Equation【思维+暴力】
- 最长严格上升子序列
- VS2010调试运行正常,直接exe运行错误问题
- Java中ArrayList类的用法
- java.lang.ClassNotFoundException: com.epoint.servlet.WelcomeServlet