配置类config_file:

from configparser import ConfigParser
class config_file:
def __init__(self,conf_filePath,encoding="utf-8"):
#打开配置文件,实例化ConfigParser类,并以默认utf-8的编码格式读取文件
self.cf = ConfigParser()
self.cf.read(conf_filePath,encoding)
def get_Int_Value(self,section,option):
#获取整数
return self.cf.getint(section,option)
def get_boolValue(self,section,option):
#获取布尔值
return self.cf.getboolean(section,option)
def get_strValue(self,section,option):
# 获取字符串类型的值
return self.cf.get(section,option)
def get_floatValue(self,section,option):
# 获取浮点数值
return self.cf.getfloat(section,option)
def get_sections(self):
# 获取所有的section
return self.cf.sections()
def get_options(self,section):
# 获取所有的option
return self.cf.options(section)