apache_conf [配置]的Python读取INI
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf [配置]的Python读取INI相关的知识,希望对你有一定的参考价值。
[db]
server =
username =
password =
database =
driver = {ODBC Driver 17 for SQL Server}
from configparser import ConfigParser
def load_config(self):
cf = ConfigParser()
cf.read('config.ini')
server = cf.get('db', 'server')
username = cf.get('db', 'username')
password = cf.get('db', 'password')
database = cf.get('db', 'database')
driver = cf.get('db', 'driver')
return server, username, password, database, driver
以上是关于apache_conf [配置]的Python读取INI的主要内容,如果未能解决你的问题,请参考以下文章
apache_conf 崇高的文本配置
apache_conf [vscode] vscode配置文件#配置
apache_conf phpMyAdmin配置存储未完全配置
apache_conf python ConfigParser
apache_conf python上下文?
apache_conf 配置地图