Parse XML and get node attributes in Python

preview_player
Показать описание

First, you parse(), then getroot(). From there you findall() to drill down to tags and use get() to grab properties.

Walk in the park for the modern Python programmer.
Рекомендации по теме
Комментарии
Автор

Does the layout have to match the element, root, and tag names exactly? I have a very nested XML that I’m trying to print all tags under a root (approximately 100+) but it’s very nested text. Not sure whether to use iter

cameronswink