当我运行功能时,为什么我的JSON文件弹出窗口不在工作目录中?

发布于 2025-01-28 04:37:36 字数 337 浏览 2 评论 0原文

这个想法是在下面的function函数中使用配置的输入在下面的工作目录中创建一个JSON文件。但是,该文件不是在工作目录中使用标签w创建的。关于为什么不这样做的任何想法吗?如果没有解决方案,该替代方案是什么?

def funct(var):
   varTwo= {
        "varThree":[
            {
            } 
        ]
    }
    with open("temp.json", "w") as f:
       json.dump(varTwo, f, indent=4)

The idea is for a JSON file to be created in the working directory with configured inputs in the funct function below. But the file is not created in the working directory with tag w. Any Idea as to why its not doing so? what is an alternative to this if there is no solution?

def funct(var):
   varTwo= {
        "varThree":[
            {
            } 
        ]
    }
    with open("temp.json", "w") as f:
       json.dump(varTwo, f, indent=4)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文