Using python in CGI

p.s me at home.com
Sun Feb 23 08:40:32 EST 2003


Hi there,
i'm trying to port my uni assignment from C to python, but having a few
problems figuring out some things.
Firstly, file i/o.
I want something similar to this pseudo code:

open file
while not at eof
	read first line
	if firstchar on line is not "#"
		print line
	else
		go onto next line

The python docs only discuss file.readline/s() in any depth, but I'd like
some details on how to read the first char from a line, and also the first
string from a line.

I'm also interested in any information about directly outputting text from
a file, onto the page(web browser).  Both raw( with "\n" and "\t" etc),
and ascii (just a-z, A-Z, and 0-9).


Thanks in advance for any replies,
-p-




More information about the Python-list mailing list