mirror of
https://gitee.com/coder-xiaomo/gitee2github
synced 2025-09-10 22:11:40 +08:00
单一py文件拆分为py文件模块,功能完成
This commit is contained in:
13
assets/readConfigFile.py
Normal file
13
assets/readConfigFile.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import configparser
|
||||
|
||||
def readConfigFile(configFilePath):
|
||||
# 可以不考虑配置文件不存在的情况
|
||||
|
||||
# 实例化configParser对象
|
||||
config = configparser.ConfigParser()
|
||||
# -read读取ini文件
|
||||
config.read(configFilePath, encoding='UTF-8') # GB18030
|
||||
# -sections得到所有的section,并以列表的形式返回
|
||||
# configSections = config.sections()
|
||||
return config
|
||||
print("[info] 配置文件读取完成")
|
Reference in New Issue
Block a user