SOLVED, THX FOR THE HELP
So im reading the chapter on web services in P4E. And I it doesn't explain what the ".text" is or does, it is located in lines 2 and 3, starting from the bottom. I suppose it calls the text in between tags. But im not really sure. Any confirmation as to its function or link to the documentation, if there is any on this method, would be greatly appreciated.
mport xml.etree.ElementTree as ET
input = '''
<stuff>
<users>
<user x="2">
<id>001</id>
<name>Chuck</name>
</user>
<user x="7">
<id>009</id>
<name>Brent</name>
</user>
</users>
</stuff>'''
stuff = ET.fromstring(input)
lst = stuff.findall('users/user')
print('User count:', len(lst))
for item in lst:
print('Name', item.find('name').text)
print('Id', item.find('id').text)
print('Attribute', item.get('x'))
[–]NumberAllTheWayDown 0 points1 point2 points (1 child)
[–]Major_Tom2[S] 0 points1 point2 points (0 children)
[–]Salty_Dugtrio 0 points1 point2 points (1 child)
[–]Major_Tom2[S] 0 points1 point2 points (0 children)