Skip to content

Instantly share code, notes, and snippets.

@teone
Created December 8, 2015 00:17
Show Gist options
  • Select an option

  • Save teone/76727742a58bef452539 to your computer and use it in GitHub Desktop.

Select an option

Save teone/76727742a58bef452539 to your computer and use it in GitHub Desktop.
ConfigParser
[gui]
gui_a=common
gui_b=common
[server]
server_a=common
server_b=common
gui
gui_a = specific
gui_b = common
server
server_a = common
server_b = specific
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('common')
config.read('specific')
# dump entire config file
for section in config.sections():
print section
for option in config.options(section):
print " ", option, "=", config.get(section, option)
[gui]
gui_a=specific
[server]
server_b=specific
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment