I have seen a lot of answers on how to read in a list using ConfigParser in Python:
- Lists in ConfigParser
- Getting a list from a config file with ConfigParser
- How to store dictionary and list in python config file?
- Get a list from config.ini file
But I am wondering how I can read in a list with multiple lists
For example, I have a config.ini:
[INPUT]
values = [[40000, 60000], [70000, 80000]]
A function in my main.py needs to read the above as:
[[40000, 60000], [70000, 80000]]
I am not sure if it matters, but values can be any size list, so for example:
[[40000, 60000]]
or
[[40000, 60000], [70000, 80000], [90000, 95000]]
I know the below will not work, but for clarity, I am reading the lists within the list into main.py like this:
self.values = config['INPUT']['values']
self
is there because I am using a class. These are my declarations in the beginning of main.py:
import configparser
config = configparser.ConfigParser()
config.sections()
config.read('config.ini')