노드 생성 및 노드 추가하기
CODEDRAGON ㆍDevelopment/Python
반응형
노드 생성 및 노드 추가하기
from xml.etree.ElementTree import Element, SubElement, dump
method |
description |
Element("nodename") |
노드 생성 |
node객체.attrib["attr_name"] = "attr_value" |
node객체에 속성을 추가합니다. |
Element("nodename", attr_name="attr_value") |
속성을 가진 노드 생성 |
root노드객체.append(node객체) |
노드 추가 |
SubElement(root노드객체, 'nodename') |
root노드에 새로운 노드를 하위노드로 생성하여 추가합니다. |
node객체.text='value' |
node객체(태그요소)의 문자열 정보를 저장합니다. |
dump() |
노드를 문자열로 반환합니다. |
'Development > Python' 카테고리의 다른 글
'지하철 시간대별 이용현황' 데이터 컬럼정보 (0) | 2020.03.05 |
---|---|
반복 ? (0) | 2020.03.05 |
xml 파일 쓰기, xml 파일 헤더 쓰기 (0) | 2020.03.03 |
Selenium WebDriver (0) | 2020.03.02 |
Selenium WebDriver 메소드 (0) | 2020.03.02 |