• Notice regarding image hosts and attachments. See here.

ElementTree Attribute with \"\"

Associate
Joined
14 Nov 2005
Posts
1,396
Location
Belfast
Python ElementTree Attribute with \"\"

So I'm trying to make some xml using ElementTree in Python but I can't get the Attribute to put backslashes before the quotes i.e.

What I get is:

Code:
<Foo Bar="text">

But what I want is:

Code:
<Foo Bar=\"text\">

I've had a look at the elementree code but can't work out how to make this work and the documentation is a bit dire.
 
Last edited:
Back
Top Bottom