本文整理汇总了Python中configparser.html方法的典型用法代码示例。如果您正苦于以下问题:Python configparser.html方法的具体用法?Python configparser.html怎么用?Python configparser.html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configparser
的用法示例。
在下文中一共展示了configparser.html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import configparser [as 别名]
# 或者: from configparser import html [as 别名]
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)
示例2: get_syntax_description
# 需要导入模块: import configparser [as 别名]
# 或者: from configparser import html [as 别名]
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