Python configparser.html() Examples

The following are 2 code examples of configparser.html(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module configparser , or try the search function .
Example #1
Source File: config.py    From knack with MIT License 6 votes vote down vote up
def __init__(self, config_dir, config_path, config_comment=None):
        """ Manage configuration options available in the CLI

        :param config_dir: The directory to store the config file
        :type config_dir: str
        :param config_path: The path of the config file
        :type config_path: str
        :param config_comment: The comment which will be written into the head of the config file
        :type config_comment: str

        When 'config_comment' is given, each line should start with # or ;. For details about INI file comment,
        see https://docs.python.org/3/library/configparser.html#supported-ini-file-structure
        """
        self.config_dir = config_dir
        self.config_path = config_path
        self.config_comment = config_comment
        self.config_parser = configparser.ConfigParser()
        if os.path.exists(config_path):
            self.config_parser.read(config_path) 
Example #2
Source File: configargparse.py    From ConfigArgParse with MIT License 6 votes vote down vote up
def get_syntax_description(self):
        msg = """Uses configparser module to parse an INI file which allows multi-line
        values.
        
        Allowed syntax is that for a ConfigParser with the following options:

            allow_no_value = False,
            inline_comment_prefixes = ("#",)
            strict = True
            empty_lines_in_values = False

        See https://docs.python.org/3/library/configparser.html for details.
        
        Note: INI file sections names are still treated as comments.
        """
        return msg