File modes

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu May 10 21:29:05 EDT 2007


En Thu, 10 May 2007 21:11:16 -0300, Jon Pentland <J2TheoN at gmail.com>  
escribió:

> I don't really see the use for being able to do that. Have you tried
> doing it with the 'app' mode?, But I am guessing that it is just an
> advanced mode spawned from 'w'. So, no, I don't think you can do this.

In fact you can read and write the same file, using the r+/w+/a+ modes.  
You may need a seek() when switching from reading to writing or viceversa  
(unless mode is a+ perhaps), but I can't find that in the docs; perhaps  
Python itself already takes care of this internally.

-- 
Gabriel Genellina




More information about the Python-list mailing list