小编Fed*_*zzo的帖子

打开同目录下的文件

我的包中有一个__init__.py文件,我Database想从config.json同一目录中的配置文件 ( ) 中读取一些信息。

我试过这个代码:

with open("config.json", 'r') as json_data:
    data = json.load(json_data)
print(data)
Run Code Online (Sandbox Code Playgroud)

但我收到了这个错误:

FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

错误在哪里?

json file python-3.x

5
推荐指数
0
解决办法
6811
查看次数

标签 统计

file ×1

json ×1

python-3.x ×1