I am dealing with a large set of data that can be classified to be written in one of many files. I am trying to open the files all at once so I can write to the files as I am going through the data (I am working with Python 3.7).
I could do multiple
with open(...) as ...
statements but I was wondering if there is a way to do this without having to write out the open statements for each file.
I was thinking about using a for loop to open the files but heard this is not exception safe and is bad practice.
So what do you think is the best way to open multiple files where the filenames are stored in a list?