-1
所以,下面的代码工作boto3 dynamodb通JSON作为参数
import boto3
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
table = dynamodb.Table('mytest')
myid = "123"
mylocation = "paris"
response = table.put_item(
Item={
'myid': myid,
'mylocation': mylocation
}
)
print("PutItem succeeded:")
但我怎么在运行时通过JSON而不是硬编码的身份识别码和mylocation的。 我想通过类似于“{'myid':'123','mylocation:'paris'}”的方式将其作为json字符串传递给put_item,Items。 dynamotb在boto3中可能吗?