1
0
mirror of https://gitee.com/coder-xiaomo/gitee2github synced 2025-01-26 19:30:25 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
gitee2github/assets/readConfigFile.py

13 lines
444 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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] 配置文件读取完成")