Jul-04-2023, 05:57 PM
(Jul-04-2023, 05:03 AM)jehoshua Wrote: Either no o/p or the words 'None'. There is at least one dataset that should matchThey are only attributes is in PAYEE tag,and no text.
Demo on how to parse those.
from bs4 import BeautifulSoup with open('testxml.xml', 'r') as f: file = f.read() soup = BeautifulSoup(file, 'xml') payee = soup.find('PAYEE')
# All attributes >>> payee.attrs {'email': '', 'id': 'P000031', 'matchingenabled': '0', 'name': 'Cash', 'reference': ''} # Get a singel one >>> payee['name'] 'Cash' # Or >>> payee.get('name') 'Cash'