Last active
October 30, 2020 11:33
-
-
Save orf/4b64186799e4594e89a80c3b00df5979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mailbox | |
import pathlib | |
import email | |
import tqdm | |
output_mbox = mailbox.mbox(path="output.mbox") | |
files = list(pathlib.Path("django-developers/mbox/").iterdir()) | |
for path in tqdm.tqdm(files): | |
msg = email.message_from_bytes(path.read_bytes()) | |
output_mbox.add(mailbox.Message(msg)) | |
output_mbox.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment