Last active
November 2, 2019 21:02
-
-
Save afaqk9394/5d241e08782ad15950431540bc3c7d10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import xml.etree.ElementTree as ET | |
| tree = ET.parse('persons.xml') | |
| root = tree.getroot() | |
| # total number of nodes from root | |
| print('\nNumber of Nodes:') | |
| print(len(root[0])) | |
| # all nodes data | |
| print('\nNode Data:') | |
| for elem in root: | |
| for subelem in elem: | |
| print(subelem.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment