如何在Python中访问maildir顶级文件夹中的消息?
顶级文件夹不会在list_folders()
中显示iup,并且迭代消息会在所有文件夹中显示消息,这是我不想要的。
import mailbox
import os
dirpath = os.path.join(os.environ['HOME'], 'Maildir')
mbox = mailbox.Maildir(dirpath, create=False)
print(mbox.list_folders()) # Top-level folder does not show up
folder = mbox.get_folder(???) # What do I put here?
for msg in folder.itervalues():
...