python3.12-lxml/plans/etree-fromstring.py
Tomáš Hrnčiar 15d5f1f6d7 Import from Fedora python-lxml @ 55f5648
Resolves: RHEL-17738
2024-01-15 13:56:59 +01:00

8 lines
170 B
Python

import lxml.etree as et
s = '<foo><bar baz="xyzzy">a<![CDATA[b]]>c</bar></foo>'
x = et.fromstring(s)
t = x.find('bar').text
print(t)
if t != 'abc':
raise Exception()