文件内容:
[docker]
un = 192.12.32.12
foe = 10.1.2.3
[mysql]
mydb = 172.2.3.1
脚本内容:
getJson(file): ConfigParser config cf = config.ConfigParser() cf.read(file) sdf = cf.sections() dic = {} x sdf: status = k,v cf.items(x): status == : dic[x]={k:v} status += : dic[x][k]=v status = dic __name__==: getJson()
时间: 2024-10-04 08:04:21