I have a file with 196 list in it,and I want to create new 196 output files and write each of the list in a new file, so that I will have 196 output files each containing 1
I am assuming that you want to read 196 files and then write the data (after some modification) to new 196 files. If you use maps and reduce (functional programming) it can do what you want. Though without much explanation in the question, I am unable to help much.
def modify(someString):
pass # do processing
def newfiles(oldfilename): return '%s.new.txt'%(oldfilename) # or something
filenames = ('a', 'b', 'c', 'd', ....)
handles = [(open(x, 'r'), open(newfile(x), 'w')) for x in filenames] # not using generator
tmp = [y[1].write(modify(y[0].read())) for y in handles)