我已尽力研究这个问题,包括堆栈溢出,但我只是不明白它。我只想将 Lambda 函数的输出保存到 S3 存储桶。但 S3 似乎不喜欢列表作为数据类型!?
我收到错误:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter Body, value: type: <class 'list'>, valid
types: <class 'bytes'>, <class 'bytearray'>, file-like object
Run Code Online (Sandbox Code Playgroud)
列表似乎不适合 S3 存储桶的输出类型?这是我正在使用的代码:
bucket_name = "output-bucket"
file_name = "output.json"
s3 = boto3.resource('s3')
object = s3.Object(bucket_name, file_name)
object.put(Body=output_sentences)
Run Code Online (Sandbox Code Playgroud)
我想我只是不明白它的工作原理......