Google Cloud Storage Python list_blob() not printing object list

前端 未结 2 1234
情深已故
情深已故 2021-01-22 00:46

I am Python and Google Cloud Storage newbie. I am writing a python script to get a file list from Google Cloud Storage bucket using Google Cloud Python Client Library and list_b

相关标签:
2条回答
  • 2021-01-22 01:21

    What do you see if you:

    for blob in bucket.list_blobs():
        print(blob)
        print(blob.name)
    
    0 讨论(0)
  • An example list function:

    def list_blobs(bucket_name):
        """Lists all the blobs in the bucket."""
        storage_client = storage.Client()
        bucket = storage_client.get_bucket(bucket_name)
    
        blobs = bucket.list_blobs()
    
        for blob in blobs:
            print(blob.name)
    
    0 讨论(0)
提交回复
热议问题