🔒 Preview mode. The first 15 Foundations lessons are free; this one is Pro. Start a 7-day trial to unlock the editor, AI hints and the rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial →
After the snippet above, the message has 2 parts: the plain body and the attachment.
If you run
parts = list(msg.iter_attachments())
print(len(parts))
print(parts[0].get_filename())
what do the two lines print? Type both.