/
sxfour
/
python_all_projects
Обзор
Документация
Войти
/
sxfour
/
python_all_projects
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
python_postgresql_connector/config.py
16 строк
438 B
Egor Levashov
Add files via upload
27 апр 2024, 09:37
Не верифицирован
27 апр 2024, 09:37
0311fbb
Код
Авторство
О чём код?
from configparser import ConfigParser def config(filename='database.ini', section='postgresql'): parser = ConfigParser() parser.read(filename) db = {} if parser.has_section(section): params = parser.items(section) for param in params: db[param[0]] = param[1] else: raise Exception('Section {0} not found in the {1} file'.format(section, filename)) return db