On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote: > So can I call the generator twice and receive the same file twice in 2 for loops? > > Once to get the files name and the second to process? > > for file in rootobs: > base = os.path.basename(file.name) > write_to = os.path.join("output", os.path.splitext(base)[0] + ".csv") > with open(write_to, 'w', newline='') as csvf: > for file in rootobs: > # create and write csv > > Cheers > > Sayth
I just need it to write after each file however the with open(#file) as csvf: Keeps it all open until every file processed in an output file with the name of the first file in the generator. Sayth -- https://mail.python.org/mailman/listinfo/python-list