I have a CSV file that I want am reading as a configuration file to create a list of lists to store data in.
The format of my CSV file is:
list_name, search_criteria
channel1, c1
channel2, c2
channel3, c3
I want to read in the CSV file and dynamically create the list of lists from the list_name data as it could grow and shrink over time and I always want whatever is defined in the CSV file.
The list_name in the CSV file is a "prefix" to the list name i want to create dynamically. For example, read in "channel1", "channel2", "channel3" from the csv file and create a lists of lists where "mainList[]" is the core list and contains 3 lists within it named "channel1_channel_list", "channel2_channel_list", "channel3_cannel_list".
I realize my naming conventions could be simplified so please disregard. I'll remain once i have a working solution. I will be using the search criteria to populate the lists within mainLists[].
Here is my incomplete code:
mainList = []
with open('list_config.csv') as input_file:
dictReader = csv.DictReader(input_file)
for row in dictReader:
listName = row['list_name'] + '_channel_list'