Re: [Tutor] Pretty printing XML using LXML on Python3

2013-11-30 Thread Stefan Behnel
SM, 29.11.2013 22:21: > On Thu, Nov 28, 2013 at 2:45 PM, eryksun wrote: >> On Thu, Nov 28, 2013 at 2:12 PM, SM wrote: >>> Run with Python3: >>> >>> $ python3 testx.py >>> b'\n \n some text\n\n' >> >> print() first gets the object as a string. tostring() returns bytes, >> and bytes.__str__ returns

Re: [Tutor] Pretty printing XML using LXML on Python3

2013-11-29 Thread SM
Thank you, eryksun. using tounicode seems to work on this small piece of code. It still has issues with my code which is generating a big XML code. I will figure out why. -SM On Thu, Nov 28, 2013 at 2:45 PM, eryksun wrote: > On Thu, Nov 28, 2013 at 2:12 PM, SM wrote: > > Run with Python3: > >

Re: [Tutor] Pretty printing XML using LXML on Python3

2013-11-28 Thread eryksun
On Thu, Nov 28, 2013 at 2:12 PM, SM wrote: > Run with Python3: > > $ python3 testx.py > b'\n \n some text\n\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 toun

[Tutor] Pretty printing XML using LXML on Python3

2013-11-28 Thread SM
Hello, I am using lxml with Python3, to generate xml code. "pretty_print" doesn't seem to indent the generated lines. I have installed the following lxml package: /usr/local/lib/python3.2/dist-packages/lxml-3.2.4-py3.2-linux-x86_64.egg/lxml The following is the example code I found on stack overf