簡體   English   中英

如何在 Python 中直接在 s3 中的文件中寫入 JSON?

[英]How can I write JSON in file in s3 directly in Python?

我在 python 中有數據a=[{a:1,b:1},{a:3,b:3}] 如何將 S3 (boto3) 中的這些 JSON 作為文件直接寫入 Python?

import json
import boto3

s3 = boto3.client('s3')
a=[{"a":1,"b":1},{"a":3,"b":3}]
s3.put_object(
     Body=json.dumps(a),
     Bucket='your_bucket_name',
     Key='your_key_here'
)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM