[Tutor] File access codes in Python
Andrei Kulakov
ak@silmarill.org
Sat, 18 May 2002 21:07:15 -0400
On Sat, May 18, 2002 at 07:59:05PM -0500, Henry Steigerwaldt wrote:
> To All:
>
> In Tcl, one can open a file for reading, writing, and both reading AND writing.
>
> However, in Python, it appears from the book I have, and from some online
> information, that one does not have the option to open a file for BOTH reading
> and writing.
>
> Is this true? If it is, it complicates the situation. One should not have to open
> a program TWICE, just to read the file at one point, and then write to the same
> file at some other point in the program.
>
> Thanks.
>
> Henry Steigerwaldt
> Hermitage, TN
> Email: hsteiger@comcast.net
>
Yeah, you can do that:
f = open("test", 'r+')
--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org