擅长:python、mysql、java
<p>通过列表理解,您可以:</p>
<pre><code>[account["accountName"] for account in Accounts["accounts"]]
Out[13]: ['US Account', 'Orange Account', 'f safasf']
</code></pre>
<p>这与您正在执行的操作类似,只是循环是:</p>
<pre><code>accountsList = []
for account in Accounts["accounts"]: #because the "accounts" key gives a list
accountsList.append(account["accountName"]) #under that list, there are 3 dictionaries and you want the key "accountName" of each dictionary
</code></pre>