擅长:python、mysql、java
<p>您可能还需要查看<a href="https://github.com/GoogleCloudPlatform/gcloud-python" rel="noreferrer">gcloud-python</a>和<a href="http://googlecloudplatform.github.io/gcloud-python/storage-api.html#gcloud.storage.bucket.Bucket.get_all_keys" rel="noreferrer">documentation</a>。</p>
<pre><code>from gcloud import storage
connection = storage.get_connection(project_name, email, private_key_path)
bucket = connection.get_bucket('my-bucket')
for key in bucket:
if key.name == 'abc.txt':
print 'Found it!'
break
</code></pre>
<p>但是,最好检查文件是否存在:</p>
<pre><code>if 'abc.txt' in bucket:
print 'Found it!'
</code></pre>