我是Python和Google Cloud Storage的新手。 我正在编写一个python脚本,使用Google Cloud Python Client Library从Google Cloud Storage存储桶中获取文件列表,并且Bucket类中的list_blobs()函数未按预期工作。Google Cloud Storage Python list_blob()不打印对象列表
https://googlecloudplatform.github.io/google-cloud-python/stable/storage-buckets.html
这里是我的Python代码:
from google.cloud import storage
from google.cloud.storage import Blob
client = storage.Client.from_service_account_json(service_account_json_key_path, project_id)
bucket = client.get_bucket(bucket_id)
print(bucket.list_blobs())
如果我理解正确的文档,打印(bucket.list_blobs())应该打印是这样的: 'TESTFILE.TXT', 'testfile2.txt']。
然而,我的脚本印刷这样的:
delete_blob()的文档 “0x7fdfdbcac590 google.cloud.storage.bucket._BlobIterator对象” 具有例如代码相同矿。 https://googlecloudplatform.github.io/google-cloud-python/stable/storage-buckets.html
我不知道我在做什么错在这里。 任何指针/示例/答案将不胜感激。谢谢!
它的工作原理!谢谢! – bkang61wk