handle_config.py
518 Bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2022/12/9 00:30
# @Author : Shitou
# @FileName: handle_config.py
# @Software: PyCharm
"""
封装读取ini文件
"""
import os
from configparser import ConfigParser
from common.handle_path import Config_Path
class Config(ConfigParser):
def __init__(self, filename, encoding='utf-8'):
super().__init__()
self.read(filename, encoding=encoding)
# 创建一个配置文件解析器
conf = Config(os.path.join(Config_Path, "config.ini"))