【发布时间】:2019-06-13 01:55:08
【问题描述】:
我想打印 Python 配置解析器对象的内容。
以下代码
for section in system_config.config.sections():
print ("\n[" + section + "]")
for (key, value) in system_config.config.items(section):
print(key + "=" + value)
打印
[GENERAL]
data_roots=[["c:\\data", "/data"] , ["d:\\data2", "/data2"]]
test_data_folder=c:\data\atp-test-data
mount_render_python_apps=false
mount_render_modules=false
host_memory=24
host_number_of_cores=4
at_core_threads=15
为了可读性,最好使用以下内容:
[GENERAL]
data_roots = [["c:\\data", "/data"] , ["d:\\data2", "/data2"]]
test_data_folder = c:\data\atp-test-data
mount_render_python_apps = false
mount_render_modules = false
host_memory = 24
host_number_of_cores = 4
at_core_threads = 15
在 C++ 中,这可以通过在使用流运算符“
问题是,如何用 Python 做到这一点?
【问题讨论】:
-
也许使用标签 '\t' ?
-
请看页面顶部的链接。
标签: python