[Tutor] Reading and Writing

Nicole Seitz Nicole.Seitz@urz.uni-hd.de
Thu, 29 Aug 2002 16:55:25 +0000


hi there!

I wrote a program, which opens a file, reads its data, gets out some=20
information and than writes this stuff to a file.
It works fine, but I like to make the reading and writing process more=20
comfortable.

So far, to open the input and output file, I did the following:

infile =3D open("C:\WINDOWS\Desktop\python_scripts\html\ez-z.html").read(=
)
 outFile =3D open("C:\WINDOWS\Desktop\python_scripts\info\ez-z.txt","w")

But there's not only one file to open, there are about 20, all of them in=
 the=20
same directory. My question now is:

Is it possible to have the program open each of the files in this directo=
ry =20
and for each input file, create an output file with a proper name(what I =
mean=20
is this: for ez-a.htm I like to have ez-a.txt, and so on), so that I have=
 to=20
run my program only one time?

Thanks for your help in advance.

Nicole