You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

有没有类似s3fs的Python库可用于Azure Blob Storage打开文件句柄?

适用于Azure Blob Storage的类似s3fs的Python库

当然有,以下是两个常用的选项:

1. azure-storage-blob(官方SDK)

这是Azure官方提供的Blob存储Python库,支持以文件句柄形式读取Blob内容,用法如下:

from azure.storage.blob import BlobServiceClient, BlobClient

# 初始化Blob客户端
blob_service_client = BlobServiceClient.from_connection_string("你的Azure存储账户连接字符串")
blob_client = blob_service_client.get_blob_client(container="my-container", blob="my-file.txt")

# 以文件句柄形式读取内容
with blob_client.open_read() as f:
    print(f.read())

2. fsspec(兼容Azure Blob的文件系统抽象库)

你熟悉的s3fs就是基于fsspec开发的,而fsspec本身支持Azure Blob Storage后端,用法和s3fs非常相似,学习成本低:

import fsspec

# 初始化Azure Blob文件系统
fs = fsspec.filesystem('az', account_name="你的存储账户名", account_key="你的存储账户密钥")

# 以文件句柄形式读取Blob
with fs.open('my-container/my-file.txt', 'rb') as f:
    print(f.read())

内容的提问来源于stack exchange,提问作者Kevin Tianyu Xu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 11:03:09