python-3.x - 如何将布尔值(由函数返回)传递给 boto3 put_item() 函数
问题描述
我有一个功能,
def _get_package_(sandboxId):
for i in response_tci_sandboxes['Items']:
if sandboxId == i['id']['S']:
if i.get('sandboxType') == 'operational':
return True ## Please note that true(lowercase) is not allowed
else:
return False
return 1
现在的问题是,当我将上述函数返回的值传递给 put_item 函数时,它会抛出错误,因为它期望布尔值是小写的,即 true 或 false。
我试着用这样的东西。
str(_get_package_(sandboxId)).lower
但是 put_item 将它作为一个字符串,并且请求被拒绝,因为数据类型是 BOOL。
解决方案
推荐阅读
- jpa - 对于@SpringBootTest,为什么我会告诉我“配置错误:发现@BootstrapWith 的多个声明”,即使我没有一个?
- delphi - 是否可以在 Python 上读取 FireDAC MemTable?
- dask - Dask iloc 解决方法?
- excel - 更新日期时如何更改单元格的值?
- android - 如何等到所有视图模型异步操作完成
- html - 某些 HTML 文本在 Android 设备上的 Google Chrome 中显示过大
- php - Laravel 6 雄辩的多类别关系
- javascript - Nodejs 使用安全路由 jwt 获得 401 Unauthorized
- bitbucket - 如何在 BitBucket 上显示 HTML 文件?
- typescript - 在这种情况下如何在没有未定义的情况下获得类型部分