【发布时间】:2019-07-23 04:45:54
【问题描述】:
我有 Db.ini 文件,我想使用 python 的 configparser 将文件作为一个部分读取和写入。谁能解释我如何使用 configparser 将配置文件作为一个部分读取和写入?
Db.ini
[mysql]
host = localhost
user = user7
passwd = s$cret
db = ydb
[postgresql]
host = localhost
user = user8
passwd = mypwd$7
db = testdb
【问题讨论】:
-
疑问部分:“如何编写配置文件”?
-
是的,如何编写配置文件
-
所以你有 .ini 文件,你想把它写入 .config 文件然后读取它?
-
下面我已经提到了源代码,我已经阅读了.ini文件。另外,我想将它们写入单独的文件
标签: python ini configparser configsection