Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在AmazonS3中的集合中添加项目?_Python_Amazon Web Services_Amazon S3_Amazon_Boto3 - Fatal编程技术网

Python 如何在AmazonS3中的集合中添加项目?

Python 如何在AmazonS3中的集合中添加项目?,python,amazon-web-services,amazon-s3,amazon,boto3,Python,Amazon Web Services,Amazon S3,Amazon,Boto3,我有以下创建数据收集的代码: import boto3 def createCollection(): cliente = boto3.client('rekognition') respuesta = cliente.create_collection (CollectionId = 'Fotos') print (respuesta) createCollection() 但我的问题是如何在此集合中添加项目。 你能帮帮我吗。 谢谢。假设您

我有以下创建数据收集的代码:

import boto3

def createCollection():
        cliente = boto3.client('rekognition')
        respuesta = cliente.create_collection (CollectionId = 'Fotos')
        print (respuesta)

createCollection()
但我的问题是如何在此集合中添加项目。 你能帮帮我吗。
谢谢。

假设您正在尝试从本地文件系统向集合添加映像,您可以使用以下方法:


没问题!如果你对答案感到满意,别忘了接受它
with open('image.png', 'rb') as image:
    respuesta = cliente.index_faces(Image={'Bytes': image.read()}, CollectionId='Fotos')
    print respuesta