Last active
July 8, 2019 14:22
-
-
Save belyaev-pa/9f95274acfe970f05da3bd0ad2d9f838 to your computer and use it in GitHub Desktop.
This file contains 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
# -*- coding: utf-8 -*- | |
import ConfigParser | |
def parse_conf(conf_file_path): | |
""" | |
Функция парсинга конфиг файла | |
одноименные ключи будут затерты, будет взят последний | |
:param conf_file_path: путь до файла | |
:return: сформированный словарь настроек | |
""" | |
config = ConfigParser.ConfigParser() | |
config.read(conf_file_path) | |
config_dict = dict() | |
for section in config.sections(): | |
section_dict = {key: value for (key, value) in config.items(section)} | |
config_dict.update(section_dict) | |
return config_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment