繁体   English   中英

使用 python 将文件加载到 Azure 文件存储

[英]Load files to Azure file storage using python

我正在使用 azure 文件存储来存储多个容器实例的数据,在这方面,它工作正常。 我遇到的问题是,一些容器读取了我通过 web 接口手动加载到文件存储的数据。 我需要更新它才能从 python 加载文件,但我没有找到任何关于如何做到这一点的示例。

有一个来自 Azure https://github.com/Azure/azure-storage-python的 github 存储库,它应该只处理源代码,但我没有找到任何示例。 在媒体和其他网站上,我找到了使用 Blob 的教程,但我没有找到任何文件

正如评论所说,示例显示了文件共享的操作。 我假设您想从文件共享中的文件中读取内容,下面的代码相同:

from azure.storage.file import FileService

storageAccount='xxxxx'
accountKey='xxxxx'

file_service = FileService(account_name=storageAccount, account_key=accountKey)

# if the file in the root path of the share, please let the directory name as ''
file = file_service.get_file_to_text(share_name, directory_name, file_name)
print(file.content)

此代码获取类型为File的文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM