Lets say that i have function load_from_xml() which loads string from XML file. String contains escape sequences for example: "Here\x20are\x20spaces"
. When i want to print it I get:
s = str(load_from_xml())
print(s)
>"Here\x20are\x20spaces"
which is not desired output. Desired output would be:
>"Here are spaces"
Any idea why print() ignores escape sequences?
Edit: Sample of function of load_from_xml():
import xml.etree.ElementTree as ET
def load_from_xml():
xml_string = "<data>Here\\x20are\\x20spaces</data>" # double \\ so data are stored like \x20
root = ET.fromstring(xml_string)
return root.text