日々精進

新しく学んだことを書き留めていきます

2016-08-26から1日間の記事一覧

S3にファイルがあるかどうかを判定する

AI

以下の関数で判定できる。 import boto3 import botocore BUCKET = "バケット名" def exist_file_in_s3(key): s3 = boto3.resource('s3') try: s3.Object(BUCKET, key).load() except botocore.exceptions.ClientError as e: if e.response['Error']['Code']…