On 13/10/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote:
> Also if a file exists, and we open it in a write mode, it would be truncated
> to zero length. So what is the way out of this??#

You can open in append mode..

>>> f = open('foo', 'w')
>>> f.write('Hello ')
>>> f.close()
>>> f = open('foo', 'a')
>>> f.write('world!')
>>> f.close()
>>> f = open('foo', 'r')
>>> f.read()
'Hello world!'

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to