#! /usr/bin/env python
# -*- coding: UTF-8 -*-
# @Time : 2018/12/27 16:56
# @Author : lihongwei@integritytech.com.cn
# @Site :
# @File : processing.py
# @Software : PyCharm
import configparser
class ConfigReader(object):
def __init__(self, config_file):
self.cf = configparser.ConfigParser()
self.cf.read(config_file)
def read_config(self, name, key):
result = self.cf.get(name, key)
return result
# class Settings(object):
# def __init__(self, config_file):
# self.cf = configparser.ConfigParser()
# self.cf.read(config_file)
# for section in self.cf.sections():
# for option in self.cf.options(section):
# str = self.cf.get(section, option)
# setattr(self, option, str)
class Settings(object):
def __init__(self, config_file):
self.cf = co
python3读取ini配置文件之configparser
最新推荐文章于 2022-12-20 09:59:07 发布