George Sakkis wrote:
Fredrik Lundh wrote:
[EMAIL PROTECTED] wrote:
I wanted to see what would happen if one used the results of a tostring
method as input into the XML method. What I observed is this:
a) beforeCtag.text is of type type 'str'
b) beforeCtag.text when printed displays: I'm
Stefan Behnel wrote:
George Sakkis wrote:
Fredrik Lundh wrote:
[EMAIL PROTECTED] wrote:
I wanted to see what would happen if one used the results of a tostring
method as input into the XML method. What I observed is this:
a) beforeCtag.text is of type type 'str'
b)
George Sakkis wrote:
I'm currently using
(a variation of) the workaround below instead of ET.tostring and it
works fine for me:
def tostring(element, encoding=None):
text = element.text
if text:
if not isinstance(text, basestring):
text2 =
Fredrik Lundh wrote:
[EMAIL PROTECTED] wrote:
I wanted to see what would happen if one used the results of a tostring
method as input into the XML method. What I observed is this:
a) beforeCtag.text is of type type 'str'
b) beforeCtag.text when printed displays: I'm confused
c)
[EMAIL PROTECTED] wrote:
I wanted to see what would happen if one used the results of a tostring
method as input into the XML method. What I observed is this:
a) beforeCtag.text is of type type 'str'
b) beforeCtag.text when printed displays: I'm confused
c) afterCtag.text is of type type
O/S: Windows XP Home
Vsn of Python: 2.4
Copy/paste of interactive window is immediately below; the
text/questions toward the bottom of this post will refer to the content
of the copy/paste
from elementtree import ElementTree
beforeRoot = ElementTree.Element('beforeRoot')
beforeCtag =
[EMAIL PROTECTED] wrote:
Question 1: assuming the following:
a) beforeCtag.text gets assigned a value of 'I\x92m confused'
b) afterRoot is built using the XML() method where the input to the
XML() method is the results of a tostring() method from beforeRoot
Are there any settings/arguments
[EMAIL PROTECTED] wrote:
O/S: Windows XP Home
Vsn of Python: 2.4
[snip fighting with unicode character U+2019 (RIGHT SINGLE QUOTATION
MARK) ]
I don't know what console you use but if it is IDLE you'll get confused
even more because it is buggy and improperly handles that character:
print