How to concatenate external files ..?

Randolph MacKenzie rmack at eznet.net
Thu Jun 29 04:20:49 EDT 2000


I want to combine all the little *.htm files in a directory into one big
file.

import sys, string, glob, os

#First I create a list:
fls = glob.glob('C:\\wxpython\\wxPython-2.1.16\\docs\\wx\\wx*.htm')

#Then I guess I should open an output file for writing
outfile = open('temp.txt,'r')

Now what  .. how do I iterate over the list and specify that each file is to
be read and appended to "outfile" ?

for x in fls:
    ???

-Randy






More information about the Python-list mailing list