I have the following line of code: xml = BytesIO("<A><B>some text</B></A>") for the file named test.xml.
But I would like to have something like xml = "/home/user1/test.xml"
How can I use the file location instread of having to put the file content?
Exactly like you have.  lxml.etree.parse() accepts a string filename and will read the file for you.
XML file as input