2 回答
![?](http://img1.sycdn.imooc.com/545863c10001865402200220-100-100.jpg)
TA贡献1790条经验 获得超9个赞
我无法在本地存储任何内容,但我能够将我的帮助程序文件/函数存储在存储 blob 中,并使用以下命令在本地下载 blob:
with open(os.path.join(tempfile.gettempdir(), 'input.csv'), 'wb') as input: input.write(blob_client.download_blob().readall())
这并不能解决具体问题,但它是一个可以接受的解决方法。
![?](http://img1.sycdn.imooc.com/56fb3e3d0001a10301000100-100-100.jpg)
TA贡献1836条经验 获得超5个赞
我看到这个片段希望能完成类似的事情。我把与我无关的部分都拿出来了。这可以在 vscode 中使用函数应用程序的测试功能时创建一个文件(func start):(来自https://option40.com/blog/azure)
import logging
import tempfile
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
dir_path = tempfile.gettempdir()
file = dir_path + "\test.txt"
name = "Me"
with open(file, mode="w") as f:
f.write(f"{name}")
with open(file) as f:
new = f.read()
if name:
return func.HttpResponse(f"{file}, {new}")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
我的结果:C:\Users\myName\AppData\Local\Temp\test.txt,Me
添加回答
举报