I'm not sure I understand this correctly but if you want to create a config file to easily read a list like you've shown then create a section in your configs.ini
[section]
key = value
key2 = value2
key3 = value3
and then
>> config = ConfigParser.RawConfigParser()
>> config.read('configs.ini')
>> items = config.items('section')
>> items
[('key', 'value'), ('key2', 'value2'), ('key3', 'value3')]
which is basically what you say you need.
If on the other hand what you are saying is that your config file contains:
[section]
couples = [("somekey1", "somevalue1"), ("somekey2", "somevalue2"), ("somekey3", "somevalue3")]
what you could do is extend the config parser like for example so:
class MyConfigParser(ConfigParser.RawConfigParser):
def get_list_of_tups(self, section, option):
value = self.get(section, option)
import re
couples = re.finditer('\("([a-z0-9]*)", "([a-z0-9]*)"\)', value)
return [(c.group(1), c.group(2)) for c in couples]
and then your new parser can get fetch your list for you:
>> my_config = MyConfigParser()
>> my_config.read('example.cfg')
>> couples = my_config.get_list_of_tups('section', 'couples')
>> couples
[('somekey1', 'somevalue1'), ('somekey2', 'somevalue2'), ('somekey3', 'somevalue3')]
The second situation is just making things hard for yourself I think.