用户工具

站点工具


linux:python:xml.etree.elementtree使用

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
linux:python:xml.etree.elementtree使用 [2026/10/13 22:06] – 外部编辑 127.0.0.1linux:python:xml.etree.elementtree使用 [2026/10/13 22:51] (当前版本) – 外部编辑 127.0.0.1
行 3: 行 3:
 有3种方法: 有3种方法:
  
-<code python>+ 
 +```python
 import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
  
行 20: 行 21:
 fbuf = fh.read() fbuf = fh.read()
 root = ET.fromstring(fbuf) root = ET.fromstring(fbuf)
 +```
  
-</code> 
  
  
 ## - 获取attrib ## - 获取attrib
-<code python>+ 
 +```python
 name = root.attrib['name'] name = root.attrib['name']
-</code>+``` 
  
  
linux/python/xml.etree.elementtree使用.1791900372.txt.gz · 最后更改: 由 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki