On Thu, Nov 28, 2013 at 2:12 PM, SM <sunith...@gmail.com> wrote:
> Run with Python3:
>
> $ python3 testx.py
> b'<root>\n  <child/>\n  <child>some text</child>\n</root>\n'

print() first gets the object as a string. tostring() returns bytes,
and bytes.__str__ returns the same as bytes.__repr__. You can decode
the bytes before printing, or instead use tounicode():

    >>> s = etree.tounicode(root, pretty_print=True)
    >>> print(s)
    <root>
      <child/>
      <child>some text</child>
    </root>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to