<p>我正在遍历一个数据库列</p>
<p>我需要创建一个字典,如果满足条件,它会更新某些键的某些值</p>
<p>比如说</p>
<pre><code>The first iteration is: 'apples'
The dictionary should be {'apples': 1}
The second iteration is: 'peers'
The dictionary should be {'apples': 1, 'peers': 1}
The third iteration is: 'apples'
The dictionary should be {'apples': 2, 'peers': 1}
</code></pre>
<p>我为基本的解释道歉。这是(我认为)传达我想要的东西的最好方式,因为我不知道如何编写代码</p>
<p>我需要将其放在字典中,因为此操作深入到嵌套for循环结构中</p>
<p>目标是:</p>
<p>就是得到最容易出现的迭代</p>
<p>预期结果:</p>
<pre><code>mostListed = 'apples'
</code></pre>
<p>我是python新手,如果我遗漏了一些明显的东西,我会非常乐于学习</p>