Demo entry 6749630

test

   

Submitted by anonymous on Jun 13, 2018 at 16:45
Language: Python 3. Code size: 460 Bytes.

import configparser
config = configparser.ConfigParser()          # 实例化
config.read(self.path, encoding="utf-8")      # 读取配置文件
def get_config(self, section, option):
    if not self.conf.has_section(section):
       print("no such section named %s"%section)
       exit(1)
    elif not self.conf.has_option(section, option):
       print("no %s option in %s"%(option, section))
       exit(1)
    else:
       return self.conf.get(section, option)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).