I have the following:
config = ConfigParser()
config.read(\'connections.cfg\')
sections = config.sections()
How can I close the file opened
The difference between ConfigParser
and RawConfigParser
is that ConfigParser
will attempt to "magically" expand references to other config variables, like so:
x = 9000 %(y)s
y = spoons
In this case, x
will be 9000 spoons
, and y
will just be spoons
. If you need this expansion feature, the docs recommend that you instead use SafeConfigParser
. I don't know what exatly the difference between the two is. If you don't need the expansion (you probably don't) just need RawConfigParser
.