Re: Remove whitespaces and line breaks in a XML file

2011-02-11 Thread Sven
On 2011-02-07 18:46:17 -0500, Josh English said: I found the code posted at http://infix.se/2007/02/06/gentlemen-indent-your-xml quite helpful in turning my xml into human-readable structures. It works best for XML-Data. lxml, which the code is using, already has a pretty_print feature acc

Re: Remove whitespaces and line breaks in a XML file

2011-02-09 Thread Jean-Michel Pichavant
Josh English wrote: I found the code posted at http://infix.se/2007/02/06/gentlemen-indent-your-xml quite helpful in turning my xml into human-readable structures. It works best for XML-Data. Josh It's done in one line with http://docs.python.org/library/xml.dom.minidom.html#xml.dom.mini

RE: Remove whitespaces and line breaks in a XML file

2011-02-08 Thread David Vicente
-list@python.org CC: python-list@python.org Asunto: Re: Remove whitespaces and line breaks in a XML file I found the code posted at http://infix.se/2007/02/06/gentlemen-indent-your-xml quite helpful in turning my xml into human-readable structures. It works best for XML-Data. Josh -- http

Re: Remove whitespaces and line breaks in a XML file

2011-02-07 Thread Josh English
I found the code posted at http://infix.se/2007/02/06/gentlemen-indent-your-xml quite helpful in turning my xml into human-readable structures. It works best for XML-Data. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove whitespaces and line breaks in a XML file

2011-02-07 Thread Stefan Behnel
David Vicente, 07.02.2011 18:45: I´m parsing an xml file with xml.etree. It works correctly, but I have a problem with the text attribute of the elements which should be empty. For example, in this case: Ken The text element of “book” should be empty, but it returns me so

Remove whitespaces and line breaks in a XML file

2011-02-07 Thread David Vicente
Hi, I´m parsing an xml file with xml.etree. It works correctly, but I have a problem with the text attribute of the elements which should be empty. For example, in this case: Ken The text element of “book” should be empty, but it returns me some whitespaces and break li

Re: Line breaks in list causing a small formatting problem while joining the list

2011-01-21 Thread GrayShark
On Fri, 21 Jan 2011 07:39:26 -0800, Oltmans wrote: > Hi Python gurus, hope you're doing well. I've a small problem. > > When I run the following code > ___ names = ['oltmans','abramhovic','\n','sal','lee'] print '| ' + ' | '.join(names) >

Re: Line breaks in list causing a small formatting problem while joining the list

2011-01-21 Thread MRAB
On 21/01/2011 16:25, Peter Otten wrote: Oltmans wrote: Hi Python gurus, hope you're doing well. I've a small problem. When I run the following code ___ names = ['oltmans','abramhovic','\n','sal','lee'] print '| ' + ' | '.join(names) | oltmans |

Re: Line breaks in list causing a small formatting problem while joining the list

2011-01-21 Thread Peter Otten
Oltmans wrote: > Hi Python gurus, hope you're doing well. I've a small problem. > > When I run the following code > ___ names = ['oltmans','abramhovic','\n','sal','lee'] print '| ' + ' | '.join(names) > | oltmans | abramhovic | > | sal |

Line breaks in list causing a small formatting problem while joining the list

2011-01-21 Thread Oltmans
Hi Python gurus, hope you're doing well. I've a small problem. When I run the following code ___ >>> names = ['oltmans','abramhovic','\n','sal','lee'] >>> print '| ' + ' | '.join(names) | oltmans | abramhovic | | sal | lee __

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Diez B. Roggisch
hackingKK writes: > On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote: >> In message, hackingKK >> wrote: >> >> >>> I want to know if there is a way to have the ElementTree module write to >>> an xml file with line breaks?

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Stefan Behnel
hackingKK, 31.10.2010 10:04: On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote: hackingKK wrote: Further more, I just was curious why elementtree is not having the namespace facility? ElementTree handles namespaces just fine. So is there a function to generate tags with namespac

Re: no line breaks in xml file with elementTree

2010-10-31 Thread hackingKK
On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote: In message, hackingKK wrote: I want to know if there is a way to have the ElementTree module write to an xml file with line breaks? Why does it matter? The XML files you generate are not for humans to look at, are

Re: no line breaks in xml file with elementTree

2010-10-31 Thread Lawrence D'Oliveiro
In message , hackingKK wrote: > I want to know if there is a way to have the ElementTree module write to > an xml file with line breaks? Why does it matter? The XML files you generate are not for humans to look at, are they? > Further more, I just was curious why elementtree is not h

no line breaks in xml file with elementTree

2010-10-31 Thread hackingKK
Hello all. I want to know if there is a way to have the ElementTree module write to an xml file with line breaks? I find that when I use the write function from the module on a tree object, the resulting file has no line breaks. I don't want to use prittyprint because it is adding extra

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-11 Thread Thomas Jollans
On Saturday 11 September 2010, it occurred to Lawrence D'Oliveiro to exclaim: > In message , MRAB > > wrote: > > On 08/09/2010 19:07, Georg Brandl wrote: > >> Thus spake the Lord: Thou shalt indent with four spaces. No more, no > >> less. Four shall be the number of spaces thou shalt indent, and t

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-10 Thread Lawrence D'Oliveiro
In message , MRAB wrote: > On 08/09/2010 19:07, Georg Brandl wrote: > >> Thus spake the Lord: Thou shalt indent with four spaces. No more, no >> less. Four shall be the number of spaces thou shalt indent, and the >> number of thy indenting shall be four. Eight shalt thou not indent, >> nor either

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-09 Thread MRAB
On 09/09/2010 17:07, Mark Lawrence wrote: On 08/09/2010 20:30, MRAB wrote: On 08/09/2010 19:07, Georg Brandl wrote: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eig

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-09 Thread Mark Lawrence
On 08/09/2010 20:30, MRAB wrote: On 08/09/2010 19:07, Georg Brandl wrote: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-08 Thread MRAB
On 08/09/2010 19:07, Georg Brandl wrote: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou the

Re: Line Breaks

2009-11-23 Thread Gary Herron
at are you doing with msg, and *exactly* what is your evidence that line breaks are being ignored. With that information, perhaps we can identify and solve the real problem you're having. First, it does in fact ignore all line breaks, not just double line breaks. Here's

Re: Line Breaks

2009-11-23 Thread Lie Ryan
D'Arcy J.M. Cain wrote: On Mon, 23 Nov 2009 14:46:23 -0500 Susan Day wrote: First, it does in fact ignore all line breaks, not just double line breaks. Here's what I'm doing: session.sendmail(clientEmail, ourEmail2, header+msg) The email sent out has the message sans break

Re: Line Breaks

2009-11-23 Thread D'Arcy J.M. Cain
On Mon, 23 Nov 2009 14:46:23 -0500 Susan Day wrote: > First, it does in fact ignore all line breaks, not just double line breaks. > Here's what I'm doing: > session.sendmail(clientEmail, ourEmail2, header+msg) > The email sent out has the message sans breaks. You should

Re: Line Breaks

2009-11-23 Thread Susan Day
On Mon, Nov 23, 2009 at 2:26 PM, Gary Herron wrote: > >>> print 'A Message From %s:\n\n %s' % ('someone','some message') > A Message From someone: > > some message > > > So... *Exactly* what are you doing with msg, and *exactly* what

Re: Line Breaks

2009-11-23 Thread Gary Herron
Susan Day wrote: Hi; I have the following line of code I'm sending to postfix: msg = 'A Message From %s:\n\n %s' % (string.replace(customer, '_', ' '), msg) Unfortunately, it ignores the line breaks. I also tried %0A but that was ignored also. Please a

Re: Line Breaks

2009-11-23 Thread Stephen Hansen
On Mon, Nov 23, 2009 at 10:45 AM, Susan Day wrote: > Hi; > I have the following line of code I'm sending to postfix: > > msg = 'A Message From %s:\n\n %s' % (string.replace(customer, '_', ' '), > msg) > > Unfortunately, it ignores the l

Line Breaks

2009-11-23 Thread Susan Day
Hi; I have the following line of code I'm sending to postfix: msg = 'A Message From %s:\n\n %s' % (string.replace(customer, '_', ' '), msg) Unfortunately, it ignores the line breaks. I also tried %0A but that was ignored also. Please advise. TIA, Suzie

Re: TextWrapper keepking line breaks?

2008-03-11 Thread js
Hi Arnaud, Great. Thanks for your help! On Tue, Mar 11, 2008 at 10:27 AM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > On Mar 10, 11:31 pm, js <[EMAIL PROTECTED]> wrote: > > Hi list, > > > > Can I make TextWrapper keep line breaks in the text? > >

Re: TextWrapper keepking line breaks?

2008-03-10 Thread Arnaud Delobelle
On Mar 10, 11:31 pm, js <[EMAIL PROTECTED]> wrote: > Hi list, > > Can I make TextWrapper keep line breaks in the text? > > For example, > > >>> s = "spam\nham" > >>> print wrap(s) > > spam > ham > > As far as I can tell, th

TextWrapper keepking line breaks?

2008-03-10 Thread js
Hi list, Can I make TextWrapper keep line breaks in the text? For example, >>> s = "spam\nham" >>> print wrap(s) spam ham As far as I can tell, there seems no way to do this, but before writing my own solution, I want to know whether the solution already exis