bruno at modulix wrote:

> Now if what you want to do is just to rewrite the file without the blank
> files, you need to use a second file:
> 
> fin = open(path, 'r')
> fout = open(temp, 'w')
> for line in fin:
>   if line.strip():
>     fout.write(line)
> fin.close()
> fout.close()
> 
> then delete path and rename temp, and you're done. And yes, this is
> actually the canonical way to do this !-)

Thanks, that's what I want. Seems a little strange, but at least you 
showed me that line.strip() is far better than line == '\n'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to