0
初學者在這裏。你能否給我提供一個python代碼來理解如何從下面的jason塊中選擇特定的值/密鑰。使用python過濾基於specfic字符串/值對的json塊
"listeners": [
{
"ip_address": "::",
"node": "[email protected]",
"port": 5672,
"protocol": "amqp",
"socket_opts": {
"backlog": 128,
"exit_on_close": false,
"linger": [
true,
0
],
"nodelay": true
}
},
{
"ip_address": "::",
"node": "[email protected]",
"port": 25672,
"protocol": "clustering",
"socket_opts": []
},
{
"ip_address": "::",
"node": "[email protected]",
"port": 15672,
"protocol": "http",
"socket_opts": {
"port": 15672
}
}
],
對於一個例子什麼需要我只使用python的jason模塊過濾「ip地址」及其相應的值?得到像下面這樣的東西。
"listeners": [
{
"ip_address": "::",
}
},
{
"ip_address": "::",
},
}
}
],
請諮詢傢伙。先謝謝你。
由於有兩次相同的密鑰'「id」',因此「類似於下方」是不可能的...... – n00dl3
@ n00dl3謝謝。正如我第一次與json一起工作。我改變了賈森街區,你現在可以看看。請如果賈森塊格式是錯誤的更正它。我只需要了解我是如何爲我的目的編寫Python代碼的。 – bindo
閱讀[Python字典](http://www.tutorialspoint.com/python/python_dictionary.htm) – stovfl