📜  configparser 读取相对文件路径时出错 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:53.196000             🧑  作者: Mango

代码示例1
# the current directory can be changed by your program [or a module] 
# and it is in general not the directory of your program file
import configparser, os
config = configparser.ConfigParser()
config.read(os.path.join(os.path.dirname(__file__), 'config.cfg'))