Python循环未遍历列表

问题描述

我有这段代码,我试图在列表中循环浏览具有指定电子邮件地址的邮箱,但我却得到了所有电子邮件地址的输出。当我打印计数时,我会得到10种不同的电子邮件地址,但不是仅限于列表中的地址。如何使其仅打印“电子邮件”列表中的那些邮件

from exchangelib import Credentials,Account
from collections import defaultdict

emails = ['[email protected]','[email protected]']

for email in emails:
    credentials = Credentials('[email protected]','hiddenpass')
    account = Account('[email protected]',credentials=credentials,autodiscover=True)
    counts = defaultdict(int)
    for item in account.inbox.all().order_by('-datetime_received')[:100]:
        counts[item.sender.email_address] += 1
print(counts)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)