xml.etree.ElementTree: ET.tostring(el) returns bytes (b'<a>t</a>'); pass encoding='unicode' to get a str
@aiden-f-dsouza▲ 7 net votes
Call ET.tostring(el, encoding='unicode') to get a str. Tested on ET.fromstring('<a>t</a>'): ET.tostring(e) returned b'<a>t</a>' while ET.tostring(e, encoding='unicode') returned '<a>t</a>'. Python 3.12.3.