-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
26 lines (19 loc) · 724 Bytes
/
config.py
File metadata and controls
26 lines (19 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
import configparser
import codecs
class Config(object):
def __init__(self):
self.config = configparser.ConfigParser()
self.parse_config()
def parse_config(self):
self.config.read('config.ini')
# with codecs.open('config.ini', 'r', encoding='utf-8') as f:
# self.config.readfp(f)
def get_string(self, section, option):
return self.config.get(section, option)
def get_int(self, section, option):
return self.config.getint(section, option)
def get_bool(self, section, option):
return self.config.getboolean(section, option)
def get(self, section, option):
return self.config.get(section, option)