python - 为什么我的代码给我一个“mystica.json not found”错误?
问题描述
我正在尝试从 json 文件加载一些变量,但找不到该文件。
我试过删除文件并重新制作,重命名它,然后移动文件,但都没有奏效。
def loadVar():
with open('mystica.json') as read_file:
variables = json.load(read_file)
return variables
我希望它能够从中获取值mystica.json
,但它给了我错误
FileNotFoundError:[Errno 2] 没有这样的文件或目录:'mystica.json'
解决方案
推荐阅读
- python-2.7 - 'TypeError: 'int' object is not callable' 相隔 5 秒比较读数时
- python - 如何绘制图表以获得二元结果的概率
- haskell - 寻找组合
- javascript - 将 webgl2 与 PIXI 一起使用
- ios - 为 UITableViewCell 指定 Segue
- php - Laravel:在进行 LEFT JOIN 时如何制作字段别名,以便我可以访问具有相同名称的字段
- javascript - 如何添加一个计数器来显示一个 div 元素被点击了多少次?
- assembly - 为什么文件不可用不会给 $v0 带来负值?
- php - 给定的每一行必须为空或带有谷歌图表线的数组
- html - 如何使徽标出现在背景图片上?