def __conf(section, param, type=None):
try:
if type == str or type is None:
return _config_parser.get(section, param)
elif type == int:
return _config_parser.getint(section, param)
elif type == bool:
return _config_parser.getboolean(section, param)
elif type == float:
return _config_parser.getfloat(section, param)
else:
return None
except (KeyError, configparser.NoSectionError):
return None
except:
print('Error with key {0} in section {1}'.format(param, section))
sys.exit(1)
评论列表
文章目录