boto3: Best way to delete object in S3

0

There are several ways to delete single object in s3 bucket using boto3 in Python.

S3.Client.delete_object(), S3.Bucket.delete_objects(), S3.Object.delete(), ...

I don't know how to choose the best way for our code.

Would you please give me information about what features each class has, what is the point in choosing an appropriate method?

Thank you.

已提问 1 年前3262 查看次数
1 回答
0
已接受的回答

You should use S3.Client from now on. The AWS Python SDK team does not intend to add new features to the resources interface in boto3. S3.Bucket and S3.Object implement the resources interface.

Would you check the first note in the following document. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html

imiky
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则