gpt4 book ai didi

python json打印空值

转载 作者:行者123 更新时间:2023-12-01 03:47:45 24 4
gpt4 key购买 nike

当我打印banner["STATUS"]["Description"]时,我得到一个空值?

banner = {
"STATUS":[
{
"STATUS": "S",
"When": 1470157636,
"Code": 11,
"Msg": "Summary",
"Description": "nsgminer 0.9.2"
}
],
"SUMMARY": [
{
"Elapsed":1502,
"MHS av":0.00,
"Found Blocks":0,
"Getworks":58,
"Accepted":0,
"Rejected":0,
"Hardware Errors":0,
"Utility":0.00,
"Discarded":116,
"Stale":0,
"Get Failures":2,
"Local Work":180,
"Remote Failures":0,
"Network Blocks":17,
"Total MH":0.0000,
"Work Utility":0.00,
"Difficulty Accepted":0.00000000,
"Difficulty Rejected":0.00000000,
"Difficulty Stale":0.00000000,
"Best Share":0
}
],
"id":1
}

最佳答案

print banner['STATUS'][0]['Description'] # 0 will tell its the 0th index of the list

“状态”键保存一个列表。由于“描述”位于该列表中的第一个字典中,因此需要 [0] 才能访问第一个字典。

关于python json打印空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38726629/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com