Rob*_*man 6 python azure-blob-storage
如果我尝试覆盖现有的 blob:
blob_client = BlobClient.from_connection_string(connection_string, container_name, blob_name)
blob_client.upload_blob('Some text')
Run Code Online (Sandbox Code Playgroud)
我得到一个ResourceExistsError.
我可以检查 blob 是否存在,将其删除,然后上传:
try:
blob_client.get_blob_properties()
blob_client.delete_blob()
except ResourceNotFoundError:
pass
blob_client.upload_blob('Some text')
Run Code Online (Sandbox Code Playgroud)
考虑到 python azure blob 存储 API 可用的内容以及惯用的 python 样式,是否有更好的方法来覆盖现有 blob 的内容?我期望有某种覆盖参数可以在upload_blob方法中选择性地设置为 true ,但它似乎不存在。
| 归档时间: |
|
| 查看次数: |
2793 次 |
| 最近记录: |