W95 binary output from CGI script

webmaster at epls.com webmaster at epls.com
Wed Jun 23 06:31:38 CEST 1999


On Jun 22, 1999, tlhall at blackhole.nyx.net wrote:

>I'm working on a CGI script for Windows 95, and trying to send
>binary data out stdout. Every time I try to send a 
 it spits
>out 
. This really messes up a JPEG, for example.
>
>How can I get python to print just 
 ?
>I've tried
>   sys.stdout.write("
")
>and
>....

Tom, 

use a raw string -- observe the "r" before the string. See eg below:

>>> print r"abc
xyz"
abc
xyz
>>> print "abc
xyz"
abc
xyz

The first string with 
 was printed without being interpreted as a 
line feed character. (note: eg pasted from Linux, not W95)

BTW, why do you use sys.stdout.write() instead of print?

yours-CRLF-or-LF-ly

alan kang
http://www.epls.com - free groupware online





More information about the Python-list mailing list