我试图了解 Python 3.10 中带括号的新上下文管理器功能的新增功能(此处新功能的顶部项目)。
我的测试示例是尝试编写:
with (open('file1.txt', 'r') as fin, open('file2.txt', 'w') as fout):
fout.write(fin.read())
Run Code Online (Sandbox Code Playgroud)
一个超级简单的测试,在Python 3.10中完美运行。
我的问题是它在Python 3.9.4中也能完美工作吗?
在 Python 3.8.5 中对此进行测试,看起来它不起作用,从而提高了预期的SyntaxError.
我是否误解了这个更新,因为这个新语法似乎是在 3.9 中引入的?
我有一个 Angular CLI 构建的应用程序,“src/app/text-gen/text-gen.component.ts”中的脚本加载到 tensorflow.js 模型中:
this.model = await tf.loadLayersModel('../assets/models/model.json');
Run Code Online (Sandbox Code Playgroud)
引用“src/assets/models/model.json”中的 JSON。
使用 Azure 应用服务部署此应用程序时,一切正常,但由于某种原因,此 model.json 返回 404 Not Found:
查看 Kudu 控制台时,我可以在“site/wwwroot/assets/models/model.json”中看到 model.json。
另外,在“angular.json”中, my"outputPath"设置为"dist".
我确信这是一件非常明显的事情 - 我对 Angular、Web-dev、Azure 等非常陌生 - 但我似乎无法弄清楚这一点!
谢谢!!!
model.json编辑:在 Kudu 控制台中添加屏幕截图,我也尝试'/assets/models/model.json'作为路径并收到相同的错误。