Need Script For read multiple files(.txt) from a folder
cwitts at gmail.com
Fri Mar 14 07:24:55 CET 2008
On Mar 14, 6:28 am, jai_python <jayapa... at gmail.com> wrote:
> hi frenz I Need a Python Script For read multiple files(.txt) from a
> folder and write it in a single text file....
Take a look at the OS Module for the listdir funtion, you can use it
to build a list of all files in the given folder. Iterate through the
list checking to see if the file is of the correct type and if it is
then append/write it to your single file. Don't forget to flush()
your output otherwise you can easily run into memory issues.
More information about the Python-list