DEV Community

tigerfanxiao
tigerfanxiao

Posted on

How to use Python Configparser Package

import configparser
import os

def get_config(section, key):
    config = configparser.ConfigParser()
    config.read(os.path.join(APP_PATH, 'config.ini'))
    return config

CONFIG = get_config()

# You can use it as CONFIG['section']['key']

Enter fullscreen mode Exit fullscreen mode

Top comments (0)