[Tutor] File access codes in Python

Henry Steigerwaldt hsteiger@comcast.net
Sat, 18 May 2002 19:59:05 -0500


This is a multi-part message in MIME format.

--Boundary_(ID_9FVJrj2fxtLfbAnQ9gnvKA)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT

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

--Boundary_(ID_9FVJrj2fxtLfbAnQ9gnvKA)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>To All:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>In Tcl, one can open a file for reading, writing, 
and both reading AND writing. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>However, in Python, it appears from the book I 
have, and from some online</FONT></DIV>
<DIV><FONT face=Arial size=2>information, that one does not have the option 
to&nbsp;open a file for BOTH reading</FONT></DIV>
<DIV><FONT face=Arial size=2>and writing.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Is this true? If it is, it complicates the 
situation. One should not have to open</FONT></DIV>
<DIV><FONT face=Arial size=2>a program TWICE, just to read the&nbsp;file&nbsp;at 
one&nbsp;point,&nbsp;and then </FONT><FONT face=Arial size=2>write to the 
same</FONT></DIV>
<DIV><FONT face=Arial size=2>file at some&nbsp;other </FONT><FONT face=Arial 
size=2>point in the program.&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Henry Steigerwaldt</FONT></DIV>
<DIV><FONT face=Arial size=2>Hermitage, TN</FONT></DIV>
<DIV><FONT face=Arial size=2>Email:&nbsp; <A 
href="mailto:hsteiger@comcast.net">hsteiger@comcast.net</A></FONT></DIV></BODY></HTML>

--Boundary_(ID_9FVJrj2fxtLfbAnQ9gnvKA)--