回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>因此,我有一个Python文件,其中包含大量嵌套字典和列表的数据,如下所示:</p>
<pre><code>recipes = {
"recipe": {
"name": "solar_panel",
"type": "craft",
"ingredients": {
"input": [
"coal_dust",
"glass",
"coal_dust",
"glass",
"coal_dust",
"glass",
"electronic_circuit",
"generator",
"electronic_circuit"
],
"output": {
"item": "solar_panel",
"quantity": 1
}
}
},
"recipe": {
"name": "re_battery",
"type": "craft",
"ingredients": {
"input": [
"nothing",
"insulated_copper_cable",
"nothing",
"tin",
"redstone",
"tin",
"tin",
"redstone",
"tin"
],
"output": {
"item": "re_battery",
"quantity": 1
}
}
}
}
</code></pre>
<p>我有一个Python脚本</p>
<pre><code>import vanilla
print(vanilla.recipes)
</code></pre>
<p>人们可能会认为is只打印完整的数据结构,但实际上它只打印最后一个子项(列表中的第23-43行)。我觉得我错过了一些明显的东西。你知道吗</p>