本文整理匯總了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