# 封装配置文件
from configparser import ConfigParser
import os
from Common.handle_path import conf_dir
file_path = os.path.join(conf_dir, 'config.ini')
class HandleConfig(ConfigParser):
def __init__(self, file_path):
super().__init__()
self.read(file_path, encoding='utf-8')
# 路径拼接 路径+文件
conf = HandleConfig(file_path)
if __name__ == '__main__':
# conf = HandleConfig()
conf.get('log', 'name')
标签:__,file,封装,读取,配置文件,HandleConfig,conf,path From: https://www.cnblogs.com/qiu1219/p/16731336.html