[EMAIL PROTECTED] wrote:

> But I'm still having a spot of bother with the === addition
> 
> it would seem that if there is no whitespace after the ===test
> then the new === gets added to the next line
> 
> e.g file contains:
> 
> ===test (and then no whitesapace/carriage returns or anything)
> 
> and the result is:
> 
> ===test
> ===

that's probably because it *does* contain a newline.  try printing the 
line with

    print repr(line)

before and after you make the change, to see what's going on.

> I tried fidding aruond trying to make it add whitespace but it didnt
> work. 

peter's complete example contains one way to solve that:

     if line.startswith("==="):
         line = line.rstrip() + "===\n"

 > What do you think I should do?

reading the chapter on strings in your favourite Python tutorial once 
again might help, I think.  python have plenty of powerful tools for 
string processing, and most of them are quite easy to learn and use; a 
quick read of the tutorial and a little more trial and error before 
posting should be all you need.

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to