<p>如何使用 boto3 查看 S3 中存储桶内的内容? (即做一个“ls”)?<br />
执行以下操作:</p>
<pre><code class="lang-">import boto3
s3 = boto3.resource('s3')
my_bucket = s3.Bucket('some/path/')
returns:
s3.Bucket(name='some/path/')
</code></pre>
<p>我如何看到它的内容?</p>
<p>查看内容的一种方法是:</p>
<pre><code class="lang-">for my_bucket_object in my_bucket.objects.all():
print(my_bucket_object)
</code></pre>