msg = email.message_from_file(open('message.txt'))
len(msg.get_payload())
attachment = msg.get_payload()[1]
attachment.get_content_type()
open('attachment.png', 'wb').write(attachment.get_payload(decode=True))
Getting mail attachment to python file object