[Zope] removing newline character from returned python string

Dennis Allison allison@sumeru.stanford.EDU
Fri, 21 Jun 2002 14:15:41 -0700


>  I have a python script that transforms the results of a zsql method into
>  xml.  The script builds the xml in a python string and returns that
>  string as the scripts output.  The problem I have is that the string
>  contains a newline character (\n) which corrupts the xml.  I made sure
>  to strip the string before it's returned...
>  
>  XML = XML.strip()
>  return XML
>  
>  ... but the output always contains the newline character.  Does anyone
>  have suggestions on how I could fix this? 
>  

	XML = XML.replace('\n','')

is likely to do the job by removing all newlines.