# config.ini [logging] name = zangai level = DEBUG filename = testlog.log sh_level = DEBUG fh_level = INFO [env] base_url = http://api.dsad.site:8000 [test_data] username = password = [invest_user] mobile= pwd= [test_admin] mobile= pwd= [mysql] host = api.lemonban.com port = 3306 username = password =
from configparser import ConfigParser import os from commons.handle_path import CONF_DIR # handle_config class Config(ConfigParser): def __init__(self,conf_file): super().__init__() self.read(conf_file,encoding='utf-8') conf=Config(os.path.join(CONF_DIR,'config.ini')) print(conf.get("mysql", "host")) print(conf.getint("mysql", "port"))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)