기계는 거짓말하지 않는다

Python configparser key 대소문자 구분 본문

Python

Python configparser key 대소문자 구분

KillinTime 2022. 5. 21. 11:39

Python 3.6 configparser Docs

 

14.2. configparser — Configuration file parser — Python 3.6.15 문서

14.2. configparser — Configuration file parser Source code: Lib/configparser.py This module provides the ConfigParser class which implements a basic configuration language which provides a structure similar to what’s found in Microsoft Windows INI file

docs.python.org

configparser의 key에 대문자를 작성해도 config 파일을 만들어 보면 소문자로 바뀌어 있는 경우가 있다.

아래와 같이 optionxform을 작성하면 해결할 수 있다.

config = ConfigParser.RawConfigParser()
config.optionxform = str

 

Comments