我如何让 Python 返回这样的东西:
{ "status": error,
"location": loc,
"codes": {
"code1": 5,
"code2": 6,
},
}
Run Code Online (Sandbox Code Playgroud)
我认为这看起来像一个 JSON 对象?
从字面上看,“我如何返回此 dict”的答案是返回此 dict:
def some_function():
return {
"status": error,
"location": loc,
"codes": {
"code1": 5,
"code2": 6,
},
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3195 次 |
| 最近记录: |