Untested as i wrote this in notepad at work but, if i first use the generator
to create a set of filenames and then iterate it then call the generator anew
to process file may work?
Good idea or better available?
def get_list_of_names(generator_arg):
name_set = set()
for name in generator_arg:
base = os.path.basename(name.name)
filename = os.path.splitext(base)[0]
name_set.add(filename)
return name_set
for file_name in name_set:
directory = "output"
with open(os.path.join(directory, filename, 'w', newline='') as csvf:
for file in rootobs:
# create and write csv
Sayth
--
https://mail.python.org/mailman/listinfo/python-list