Python script read multiple files from a folder - Instablogs
Python script read multiple files from a folder
Jayapal , Trivandrum: Mar 14 2008
India :

Python script for read multiple files from a folder and write it in a separate single file.

Source Code:

import sys,os
path = “/home/jayapal/Desktop/route/”
fn = ‘/home/jayapal/Desktop/mapping/dem.txt’
target =open(fn, ‘w’)
for filename in os.listdir(path):
         source = open(path + filename, “r”)
         target.write(source.read())
         source.close()
target.close()

*****************************************************************************

Here fn :Output file
path :Path of folder which contain infinite files

Enjoy
Jayapal

Add Images and Videos
Close X
Recommended Tags or Keywords
Search by Tags or Keywords
Selected Media ( You can Upload only Six media )
Sorry no picture found for this combination of tags. Try to search minimum number of tags at once
Add your Comment