[Zope] Re: strange 'print' behavior in Python Scripts
Lewis, Pat H.
Pat_Lewis@Invesco.com
Fri, 29 Jun 2001 13:16:03 -0400
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C100BF.2CD5FEE0
Content-Type: text/plain;
charset="iso-8859-1"
I have no idea why Python Scripts is acting this way. Can you generate your
xml without
using triple quotes?
print 'foo\nbar'
or
print '%s\n%s' % ('foo', 'bar')
--
Patrick Lewis
"Christopher N. Deckard" wrote:
> Clarification, this happens when using triple quotes
>
> print '''
> foo
> bar
> '''
>
> Actually prints:
> foo
> bar
>
>-Chris
>
> >"Christopher N. Deckard" wrote:
> >
> > I'm running into problems because Zope is printing a space (" ") at the
> > beginning of each line when 'print'ing from a Python Script. I'm trying
> > to print out XML to a Java Applet and the Applet isn't smart enough to
> > take this into account. Bad parser, but Zope shouldn't be doing this
> > anyway. Any fix that I can do?
> > -Chris
> > --
> > --------------------------------------------------------------------
> >Christopher N. Deckard | Lead Web Systems Developer
> >cnd@ecn.purdue.edu | Engineering Computer Network
> ><http://www.ecn.purdue.edu/> | Purdue University
> >---- zlib.decompress('x\234K\316Kq((-J)M\325KM)\005\000)"\005w') ---
------_=_NextPart_001_01C100BF.2CD5FEE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>Re: strange 'print' behavior in Python Scripts </TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>I have no idea why Python Scripts is acting this =
way. Can you generate your xml without</FONT>
<BR><FONT SIZE=3D2>using triple quotes?</FONT>
</P>
<P><FONT SIZE=3D2>print 'foo\nbar'</FONT>
</P>
<P><FONT SIZE=3D2>or </FONT>
</P>
<P><FONT SIZE=3D2>print '%s\n%s' % ('foo', 'bar')</FONT>
</P>
<P><FONT SIZE=3D2>--</FONT>
<BR><FONT SIZE=3D2>Patrick Lewis</FONT>
</P>
<P><FONT SIZE=3D2>"Christopher N. Deckard" wrote:</FONT>
<BR><FONT SIZE=3D2>> Clarification, this happens when using triple =
quotes</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> print ''' </FONT>
<BR><FONT SIZE=3D2>> foo </FONT>
<BR><FONT SIZE=3D2>> bar </FONT>
<BR><FONT SIZE=3D2>> ''' </FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> Actually prints: </FONT>
<BR><FONT SIZE=3D2>> foo </FONT>
<BR><FONT SIZE=3D2>> bar </FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>>-Chris </FONT>
<BR><FONT SIZE=3D2>></FONT>
<BR><FONT SIZE=3D2>> >"Christopher N. Deckard" wrote: =
</FONT>
<BR><FONT SIZE=3D2>> > </FONT>
<BR><FONT SIZE=3D2>> > I'm running into problems because Zope is =
printing a space (" ") at the </FONT>
<BR><FONT SIZE=3D2>> > beginning of each line when 'print'ing =
from a Python Script. I'm trying </FONT>
<BR><FONT SIZE=3D2>> > to print out XML to a Java Applet and the =
Applet isn't smart enough to </FONT>
<BR><FONT SIZE=3D2>> > take this into account. Bad parser, but =
Zope shouldn't be doing this </FONT>
<BR><FONT SIZE=3D2>> > anyway. Any fix that I can do? </FONT>
<BR><FONT SIZE=3D2>> > -Chris </FONT>
<BR><FONT SIZE=3D2>> > -- </FONT>
<BR><FONT SIZE=3D2>> > =
-------------------------------------------------------------------- =
</FONT>
<BR><FONT SIZE=3D2>> >Christopher N. Deckard =
| Lead Web Systems Developer =
</FONT>
<BR><FONT SIZE=3D2>> >cnd@ecn.purdue.edu =
| Engineering Computer Network =
</FONT>
<BR><FONT SIZE=3D2>> ><<A HREF=3D"http://www.ecn.purdue.edu/" =
TARGET=3D"_blank">http://www.ecn.purdue.edu/</A>> | Purdue =
University </FONT>
<BR><FONT SIZE=3D2>> >---- =
zlib.decompress('x\234K\316Kq((-J)M\325KM)\005\000)"\005w') --- =
</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C100BF.2CD5FEE0--