newbie: Some file object tips?

Flavian Hardcastle deathtospam43423 at altavista.com
Tue Feb 19 06:00:19 EST 2002


I'm writing a crude cgi chat script. I've already got it up and working 
with Xitami server, and have chatted with a few net buddies.

How it works is very rough and simple... it basically just takes data from 
people's browsers (using the FieldStorage function) and stores it in a file 
called log.txt, and then displays the contents of that file back to them.

My problem is ... 

The longer you chat, the bigger the log.txt file gets, and consequently the 
web page the chatters are viewing gets bigger and bigger, and becomes hard 
to download.

So I want to include a "scroll back" feature ... which will enable the user 
to control how many previous posts (s)he views. It will probably take the 
form a simple input box on the form ... if you want to see the last 8 
posts, you put 8 in the box, if you want to see the last 50 posts, you put 
50 in the box and so on.

So, I need the script to be able to search the log.txt file. Any tips as to 
how I might go about this? 

cdewin at dingoblue.net.au





More information about the Python-list mailing list