这是我的Python代码:
if onerow[0]['result'] is None or not result['GetOdds'][0]['result']is None:
Run Code Online (Sandbox Code Playgroud)
当result为空时,它返回此错误:
if onerow[0]['result'] is None or not result['GetOdds'][0]['result']is None:
KeyError: 0
Run Code Online (Sandbox Code Playgroud)
我想要一个类似php issetpython 的东西来检查字典项目
python中有等效的函数或类吗?