Created
December 8, 2015 00:17
-
-
Save teone/76727742a58bef452539 to your computer and use it in GitHub Desktop.
ConfigParser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [gui] | |
| gui_a=common | |
| gui_b=common | |
| [server] | |
| server_a=common | |
| server_b=common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gui | |
| gui_a = specific | |
| gui_b = common | |
| server | |
| server_a = common | |
| server_b = specific |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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