使用AWS SDK for Python(boto3)中的Amazon S3服务来获取多张图片。
以下是获取S3存储桶中所有以“.jpg”扩展名结尾的对象的Python代码示例:
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('your-bucket-name')
for obj in bucket.objects.filter(Prefix='path/to/images/'):
if obj.key.endswith('.jpg'):
print(obj.key)
# do something with the image
其中,“your-bucket-name”替换为您的存储桶名称,“path/to/images/”替换为您要获取的图片的路径。您可以修改代码来实现您需要的图片获取方式。