[Tutor] Files and file attributes
Pat/Bob Fisher
pbfisher@ispchannel.com
Wed, 21 Feb 2001 17:55:11 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_0007_01C09C2F.6FB67B80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am pretty new at programming in Python, but have had experience in =
programming in other languages. I went through the tutorial which I =
thought was fairly good, except the section on the methods of file =
objects was pretty sparse. It seems to me that dealing with files is =
rather awkward. I have used the list representation filelist =3D =
f.readlines() and then used the fine list methods to manipulate the =
filelist, but I am having trouble getting a new file from my new =
filelist. The g.write('string') gives me a whole lot of extraneous =
stuff.
Another problem I am having is trying to open files in other =
directories. For example,
=20
f=3Dopen('C:\tmp\testfile','r+') just doesn't work for me.
Can anyone help, or at least tell me where I can learn more about file =
manipulation?
I suppose it is obvious I am using a windows platform, specifically =
WindowsME.
Thanks in advance,
Robert Fisher
pbfisher@bigfoot.com
------=_NextPart_000_0007_01C09C2F.6FB67B80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Courier New" size=3D2>I am pretty new at programming =
in Python,=20
but have had experience in programming in other languages. I went =
through=20
the tutorial which I thought was fairly good, except the section on the =
methods=20
of file objects was pretty sparse. It seems to me that dealing =
with files=20
is rather awkward. I have used the list representation =
filelist =3D=20
f.readlines() and then used the fine list methods to manipulate the =
filelist,=20
but I am having trouble getting a new file from my new =
filelist. The=20
g.write('string') gives me a whole lot of extraneous stuff.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Another problem I am having is =
trying =20
to open files in other directories. For example,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> </FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> =
f=3Dopen('C:\tmp\testfile','r+')=20
just doesn't work for me.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Can anyone help, or at least =
tell me where=20
I can learn more about file manipulation?</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>I suppose it is obvious I am =
using a=20
windows platform, specifically WindowsME.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Robert Fisher</FONT></DIV>
<DIV><FONT face=3D"Courier New"=20
size=3D2>pbfisher@bigfoot.com</FONT></DIV></BODY></HTML>
------=_NextPart_000_0007_01C09C2F.6FB67B80--