I want to write a program for this: In a folder I have n number of files; first read one file and perform some operation then store result in a separate file. Then
I've just learned of the os.walk() command recently, and it may help you here. It allows you to walk down a directory tree structure.
import os
OUTPUT_DIR = 'C:\\RESULTS'
for path, dirs, files in os.walk('.'):
for file in files:
read_f = open(os.join(path,file),'r')
write_f = open(os.path.join(OUTPUT_DIR,file))
# Do stuff