I am trying to import CONFIG
details from config.ini file using python. I am able to get all details into dictionary. But, dictionary contains [DEFAULT]
values too.
How do I exclude DEFAULT configurations from inserting into my dictionary.
Python code:
config = configparser.ConfigParser()
config.read("C:/config.ini")
dictionary = {}
for section in config.sections():
dictionary[section] = {}
for option in config.options(section):
print(section, option, config.get(section, option))
dictionary[section][option] = config.get(section, option)
Config File: Need to exclude CONCEPT_REFERENCE
and SCHEME
from inserting.
[DEFAULT]
CONCEPT_REFERENCE = http://www.xbrl.org/2003/arcrole/concept-reference
SCHEME = http://xbrl.org/entity/identification/scheme
[SQL]
SERVER_NAME = USER\MSSQLSERVER01
DATABASE = MYDB
[NAME]
path_to_log_file = C:/logs/
path_to_output_files = C:/Map/