ezoic

Friday, May 19, 2017

Boto3 check if a s3 folder exists



https://github.com/boto/boto3/issues/134


import boto3
import botocore

client = boto3.client('s3')
result = client.list_objects(Bucket="spark", Prefix="temp/temp2/file3" )

exists=False
if result:
    exists=True

print exists


https://github.com/boto/botocore/issues/680







2 comments:

  1. if "Contents" in result:
    exist = True
    else:
    exist = False

    ReplyDelete
    Replies
    1. shouldn't be something like?:

      if not result["Contents"]:
      # Not exists
      else:
      # Exists

      Delete

R is not a simple programming language, and it does better on reading excel files than python

R is not a simple programming language, and it does better on reading excel files than python . tried to read excel files to python and R. i...